Sliced Mirror

Files as the interface, the store as the truth.

A pattern for letting an agent work on a remote document store through plain files: a filtered mirror of the store, kept in sync by explicit pull and push.

An agent works best with plain files; a document store works best as the single source of truth. This pattern joins the two without either side learning the other: the agent sees only files, the store sees only ordinary reads and writes, and a thin sync tool between them is the only part that knows both exist.

Principles

  • The store is the truth. Locally, there's a mirror of one slice of it, selected by a query (plus any documents pinned to it) and kept as plain files.
  • Sync is explicit. Pull brings the slice down, push sends changes up. Nothing syncs in the background.
  • A manifest, not a history. It records what each file looked like at the last sync, so local edits show up without watching.
  • Optimistic writes. Each update carries the revision it was based on. If the document has moved on, it's refused, never merged.
  • The store gets the last word. After each write, the file is replaced with what the store actually kept.
  • Destruction is deliberate. Deleting a local file never touches the store, and a destructive rewrite is someone's choice, never a side effect.
  • Rules in the tool, judgment in the instructions. The tool enforces what's mechanical. What needs context is left to the agent and a person, who reviews each push before it reaches the store.

Why files

  • Visible. What's synced is what the file explorer shows. No hidden state to inspect through a separate tool.
  • Nothing to learn. Agents already work well with files, so there's no new protocol, schema or tool surface to teach them.
  • Replaceable parts. The store, the sync tool and the agent can each change without the others noticing, as long as the files keep their shape.

Trade-offs

  • Staleness. The mirror is only as fresh as the last pull. Explicit sync trades immediacy for predictability.
  • Manual conflicts. Refusing instead of merging keeps both sides safe, but a person decides what wins.
  • Slices, not the whole. The mirror holds a selection, not everything. Anything outside it stays invisible to the agent unless fetched on purpose.
  • Overwrites are final. Unless the change is written as a new version, an in-place edit replaces the old text for good.

Fit

Fits one operator or a small trusted team letting agents read and edit a bounded set of documents, where predictability matters more than immediacy.

Doesn't fit real-time collaborative editing, frequent concurrent writes to the same documents, or tasks that need the whole store in view at once.

Related

  • File over app: data that outlives the app. This pattern is about connecting files to a store that stays the truth.
  • Version control working copies: checkout, pull and push, without the history
  • HTTP conditional requests (ETag, If-Match): the shape of optimistic writes

Pull what you need. Push what you meant. Let the store decide.