Scry — Your integrated review environment

· Scry

8 min read Original article ↗

Your IDE is designed for old habits.

It was designed for editing: crawling through lines of text, changing characters one keystroke at a time. Reading was always an afterthought. After all, monospaced text is legible, isn’t it?

tidepool/scheduler/retry.ts

⌘K Go to symbol ReadChanges main E Edit Read-first

In this file

  • TRetryPolicy
  • CDEFAULT_POLICY
  • fbackoffDelay
  • fretry
  • fjitter

Used by 3

  • retry()this file
  • drain()scheduler/queue.ts
  • reconnect()http/client.ts

Uses 1

  • jitter()this file

Change 3 weeks ago

Cap the delay at maxMs

Stalled workers were sleeping for hours after a long outage. The delay now stops growing at the policy’s ceiling.

  • #418 Cap backoff at the policy ceiling

    Merged Nov 2 · approved by Imani

  • #412 Workers sleep for hours after an outage

    Closed by #418

+2 −1 scheduler/retry.ts

Contributors 9 changes

IOTRPN 3 people and agent runs

History

  1. 3 weeks ago Cap the delay at maxMs Agent run
  2. 4 months ago Double the delay each attempt Tomás Reyes
  3. Last year Move backoff out of the queue Imani Okoro

Review the change.

Commits and diffs are reading too. Open any change in a Git or jj stack as a page, with the reasoning written above the diff.

tidepool/cache-eviction

ReadChanges Read-first

Stack 4 changes

  1. maintrunk

  2. kpqxywon 3f2a91c +3 −1

    Stamp entries when they are read

  3. rlvmtzsu 8d04e7b +3 −2

    Evict the coldest entry, not the oldest

  4. ymnoqkxw b61c5fa +2 −1

    Budget by bytes instead of entries

  5. wsvzplrt e97a30d +2 −1

    Pin the eviction order in a test

Change 1 of 4 kpqx · 3f2a91c

Stamp entries when they are read

Eviction needs to know what is still in use. Every read now stamps the entry with the time, so the next change can tell warm entries from cold ones.

cache/store.ts+3 −1

41 get(key: string) {42 const hit = this.map.get(key);− return hit?.value;+ if (!hit) return undefined;+ hit.readAt = this.now();+ return hit.value;46 }

Change 2 of 4 rlvm · 8d04e7b

Evict the coldest entry, not the oldest

The cache dropped whatever went in first, even if it was read a moment ago. It now drops the entry that has gone longest without a read.

cache/store.ts+3 −2

63 private evict() {− const [first] = this.map.keys();− this.map.delete(first);+ const cold = coldest(this.map);+ this.map.delete(cold.key);+ this.onEvict?.(cold);67 }

Change 3 of 4 ymno · b61c5fa

Budget by bytes instead of entries

A thousand thumbnails and a thousand video segments are not the same load. maxBytes replaces the entry count, and eviction runs until the cache fits.

cache/store.ts+2 −1

28 set(key: string, value: Buffer) {29 this.map.set(key, wrap(value));− if (this.map.size > this.max) {+ this.bytes += value.byteLength;+ while (this.bytes > this.maxBytes) {32 this.evict();33 }

Change 4 of 4 wsvz · e97a30d

Pin the eviction order in a test

The old test passed only because insertion order and read order matched. Reading a first makes the two disagree, so the test says which one wins.

cache/store.test.ts+2 −1

12test('evicts the coldest entry', () => {13 const cache = filled('a', 'b');+ cache.get('a');15 cache.set('c', one);− expect(cache.has('a')).toBe(false);+ expect(cache.has('b')).toBe(false);17});

Annotate while your agent works.

Mark up any line the way you would in a pull request. Scry plugs in as an MCP server, so the agent picks up your notes in real time and revises as it goes.

tidepool/uploads/upload.ts

agent connected · MCP

Written by the agent revision 1 revision 2

12export async function upload(req: Request) {13 const user = await requireUser(req);14 const body = await req.arrayBuffer();15 const bytes = new Uint8Array(body);16 await store.put(user.id, bytes);+ const body = capped(req.body, MAX_BYTES);+ await store.put(user.id, body);17 return json({ ok: true });18}1920export async function remove(req: Request) {

Notes 1

Select lines to leave a note for the agent.

Your note upload.ts:14-16

This reads the whole file into memory. Stream it, and reject anything over MAX_BYTES.

Draft Sent to the agent Addressed in revision 2

MCP · live

Agent still running

editupload.ts→ revision 1 scry.annotationupload.ts:14-16→ delivered

Writing upload.test.ts… Revising upload.ts… editupload.ts+2−3→ revision 2

Read between the commits.

Trace a line back to the agent conversation that wrote it, then replay the edits in between. It needs operation-level history to work, like Zed’s DeltaDB.

tidepool/api/events.ts

history: operations

Between two commits agentyou

commit3c8d5f1 60 operations commite7b03f5

14export async function listEvents(15 page = 016): Promise<Event[]> {17 const rows = await db.events18 .offset(page * LIMIT)19202122

Conversation 52 min ago

youList events a page at a time.

agentWriting listEvents with offset paging.

op 0152line 18 added

By hand 38 min ago

youTyped directly, with no conversation behind it: fetch one row more than a page, to see if another follows.

op 0170line 20 added

Conversation 31 min ago

youPages past the first return duplicates. Use the last id as the cursor.

agentReplaced the offset with a cursor on id.

op 0184line 18 rewritten

Conversation 24 min ago

youTell the caller whether there is another page.

agentReturns a Page: the rows, and a more flag.

op 0200line 21 rewritten

Browse the codebase instead of managing files. A component, its test, its stories and its styles share one page, and following a name shows you what calls it.

› dispatch

calls uses FilesMap Trace 1/4

http/server.tsauth/guard.tssession/store.tscache/lru.ts

fdispatchfmatchRoutefauthorizefverifyTokenfloadSessionTSessionfgetCachedCTTL_MS

dispatch(req): Promise<Response>

Where every request starts: match a route, check access, then run it.

called by 1 · calls 2 http/server.ts

Code that reads like a wiki.

Headings get bigger type, names go bold, and a diagram can sit right next to the function it explains.

12/**13 * # Link lifecycle14 *15 * A link is in **exactly one** state.16 * Only `open` may send frames.17 *18 * ## Transitions19 *20 * - `connect()` dials, then **opens**21 * - `close()` drains, then goes idle22 * - a failed dial **backs off** and retries23 *24 * ![link states](docs/link-states.svg)25 *26 * | State      | Sends | Timer     |27 * | ---------- | ----- | --------- |28 * | idle       | no    | none      |29 * | connecting | no    | dial      |30 * | open       | yes   | heartbeat |31 * | closing    | no    | drain     |32 */33export type LinkState =34  | 'idle' | 'connecting'35  | 'open' | 'closing';3637export function canSend(s: LinkState) {38  return s === 'open';39}

Link lifecycle

A link is in exactly one state. Only open may send frames.

Transitions

  • connect() dials, then opens
  • close() drains, then goes idle
  • a failed dial backs off and retries

Fig. 1 · Link stateslink-states.svg

StateSendsTimer

idlenonone

connectingnodial

openyesheartbeat

closingnodrain

33export type LinkState =34  | 'idle' | 'connecting'35  | 'open' | 'closing';3637export function canSend(s: LinkState) {38  return s === 'open';39}

Docs, tickets, threads and meeting notes, beside the code.

Keep your context with your code. The spec you’re building from, the ticket in progress, the chat that’s still going, this morning’s notes, all open beside the lines they’re about.

tidepool/billing

3 sources linked to this file E Edit Read-first

Confluence Meeting notes Jira Ticket Slack Thread

Billing / Meeting notes

Billing sync

Today, 09:30 · notes by Priya Nair

PNIOTR 3 attended

Decisions

1 Time zone prorate.ts:42

Count days in the customer’s own time zone, not UTC.

2 Whole days prorate.ts:43

Credit whole days left in the period. The day of the change is not refunded.

Open questions

Do annual plans need a different cap? Tomás to ask in #billing.

Billing / BILL-482

Credit a cent too high after downgrade

In progress High proration IOImani Okoro

Rounding to the nearest cent credits more than the unused share.

3 Acceptance prorate.ts:46

Credits round down to the smallest unit of the currency, never up.

PR #519 open · review requested

Thread · 3 replies · latest 2m ago

#billing

TR Tomás Reyes 10:42

From the sync: do annual plans need a different cap?

4 Priya Nair 10:47 prorate.ts:47

No. Never refund more than they paid, even on annual plans.

IO Imani Okoro 2m ago

On it. Capping it in prorate now.

Tomás is typing…

prorate.ts billing · main

fprorate

The credit owed when a subscription changes partway through a period.

38export function prorate(39  sub: Subscription,40  at: Instant41): Money {421  const day = at.inZone(sub.account.zone);432  const left = daysLeft(sub.period, day);44  const share = left / sub.period.days;45  const owed = sub.price * share;463  const credit = Math.floor(owed);474  return Math.min(credit, sub.paid);48}

1 Line 42 § Time zone Billing sync, today · Confluence

2 Line 43 § Whole days Billing sync, today · Confluence

3 Line 46 BILL-482 Acceptance criterion · Jira

4 Line 47 Priya Nair, 10:47 #billing · Slack

Read first. Edit when you must.

A quick fix is a key away. Everything else about the screen is built for reading; debugging and the terminal stay in your editor.

A reader for the code you won’t write.

Join the waitlist for early access to test builds.

Test builds and Scry news only. Unsubscribe anytime. Privacy

Not convinced? Tell us why