You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs: 0004, local agents and rich context (proposed) - #75
One-command connect for local harnesses, opt-in capture through Claude
Code hooks, links and a local content-addressed object store, and
evidence-gated compression. Phased, with assumptions and open questions
to confirm before each phase.
Signed-off-by: Shreyansh Sancheti <43677304+shreyanshjain7174@users.noreply.github.com>
Adds a proposed, documentation-only roadmap for connecting local agent harnesses to zerodb and storing richer context. No functionality is implemented.
Changes:
Defines installation, per-user configuration, harness registration, and opt-in Claude Code capture.
Proposes link references and a local object store with durable writes and tenant-scoped access.
Sets phased delivery gates, open questions, testing requirements, and evidence-based compression criteria.
File
Description
docs/design/0004-local-agents-and-objects.md
Introduces the four-phase proposal for local agents, capture, objects, and compression.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The proposed capture-progress lookup and object-directory sync sequence need corrections to support their duplicate-prevention and durability guarantees.
Clarify CLI tenant and data directory requirements
docs/design/0004-local-agents-and-objects.md:41
This overstates the current CLI requirements: --tenant takes a tenant name, not a path, and Adapter::new in crates/zerodb/src/mcp.rs accepts relative paths and can obtain data_dir from the config. The existing MCP launch tests also use relative paths successfully. Please distinguish the requirements for local auto-start from recommendations for harness registration so readers do not supply a path as the tenant or assume --data-dir is always mandatory.
Add XDG_DATA_HOME fallback for fresh Linux accounts
docs/design/0004-local-agents-and-objects.md:52
XDG_DATA_HOME can be unset or empty on a normal Linux account, so this does not define a usable per-user home for every fresh account covered by P1. Please specify the fallback to $HOME/.local/share/zerodb; otherwise the promised no-flags setup depends on users configuring an environment variable first.
Add destination parameter for non-inline object downloads
The proposed object_get arguments contain only the object identifier, but the non-inline branch requires a destination supplied by the caller. There is no argument through which callers can provide it, leaving downloads of recordings and other non-image objects undefined. Please include a destination parameter and specify what happens when a non-inline download omits it.
Also addressed the 3 previously missed issues in 16ce251:
Current MCP flags:--tenant takes a name. The token comes from ZERODB_TOKEN, --token-file, or --config with --tenant. The server location comes from --url, --data-dir, or the config's data_dir. Relative paths resolve against the working directory. Absolute paths are a README recommendation for harness configs, not a requirement.
Linux home:$XDG_DATA_HOME/zerodb if set and not empty, else $HOME/.local/share/zerodb.
object_get {object, path?}:path is optional for small images, which come back inline, and required otherwise. zerodb never overwrites an existing file. Without path it returns an error with the size and type, and never writes to a default location.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The proposed capture recovery and object-forget contracts need clarification to support their stated guarantees.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Persist reconciliation progress across hook timeouts
docs/design/0004-local-agents-and-objects.md:81
If the intervening project history takes longer to scan than the hard hook timeout, each invocation restarts reconciliation from the same capture cursor and never reaches the append. Persist separate reconciliation progress as pages are scanned, without using other sessions' transcript positions as this session's capture cursor, or provide a bounded per-harness lookup.
Clarify forget semantics for duplicate object references
docs/design/0004-local-agents-and-objects.md:99
Two independent PUTs of identical bytes create refs for the same tenant and digest, so forgetting one ref can leave the object readable through the other, contrary to this promise. Define whether forget hides all matching refs through the I10 cutoff or hides the object only when no live refs remain. Include two independent PUTs followed by forget in the planned tests.
Addressed the 2 previously missed issues in cc3bf08:
Reconciliation bound: each harness session now captures into its own zerodb session, <project session>/<harness session id>. Only that harness writes there, and each hook run appends at most 64 entries. So reconciling after the cursor reads at most 1 page, however busy the project is. A transcript further behind catches up over later hooks. SessionStart finds the newest capture session through a project/<name>/latest-capture fact. A test fills the project with 10,000 other turns between hooks.
Object forget: a forget with an object: sha256:<hex> selector hides every ref the tenant holds to that digest, at or below the forget's LSN. A put after the forget makes a new, visible ref. Forgetting a turn hides the turn, not the object. A test covers 2 independent puts, then a forget, then a new put.
Bound generated session IDs with UTF-8-safe truncation
docs/design/0004-local-agents-and-objects.md:68
Please bound generated session identifiers to the existing 255-byte limit enforced by crates/zerodb-core/src/turn.rs:106–107. A valid 255-byte project directory name already exceeds that limit once the hash is added, so default appends fail with invalid_input; capture's additional /<harness session id> suffix further reduces the available space. Specify UTF-8-safe truncation of the readable directory name, reserving space for the hash and capture suffix.
Also fixed the previously missed session-length issue in 10d020e. The default session is the directory name cut to 229 bytes on a UTF-8 boundary, plus -<8 hex>. Capture appends /<16 hex>, a hash of the harness session id, so every generated name fits in 255 bytes. The full harness id lives in the registration and the cursor fact. A test uses a 255-byte multibyte directory name.
Handle oversized transcript entries without blocking capture
docs/design/0004-local-agents-and-objects.md:79
One transcript entry cannot always fit in one turn: turn::encode rejects content above 4 MiB (crates/zerodb-core/src/turn.rs:109), but this design places no corresponding limit on transcript entries. An oversized prompt or tool result therefore cannot be captured, and draining in order leaves every later entry stuck behind it on every hook and capture sync run. Specify deterministic size-bounded chunks with stable per-chunk retry identities and cursor-completion rules, or explicitly define an oversized-entry policy and narrow the completeness promise.
Also fixed the previously missed oversized-entry issue in 105c998. Entries over 4 MiB are split into chunks of at most 4 MiB, on UTF-8 boundaries at fixed offsets, so the same entry always splits the same way. Each chunk's idem_key is <harness session id>:<position>:<chunk>, and the cursor completes an entry only after its last chunk. Up to 16 chunks, 64 MiB, are stored. The rest is dropped and marked truncated, and completeness is stated for entries up to 64 MiB. Tests cover 10 MiB and 100 MiB entries with a kill between chunks.
Correction: my last 3 replies said "Fixed in 10d020e". That commit didn't contain those fixes, because my edit script stopped on one search string before writing anything. The fixes are in 105c998: path-hashed project ids, object tool roots, and chunked large entries. The replies' descriptions are accurate for 105c998.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The proposed capture sizing must account for JSON expansion against the HTTP body limit to avoid permanently blocking backlog capture.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Bound chunks by serialized request size to avoid permanent HTTP 413s
docs/design/0004-local-agents-and-objects.md:89
The 3 MiB content budget can exceed the 8 MiB HTTP body limit in crates/zerodb/src/http.rs:73,250–251: JSON encoding expands a chunk of U+001B characters to about 18 MiB. That chunk receives HTTP 413 on every retry, stalling the in-order capture drain. Bound deterministic chunks by both serialized request size and tape frame size, or explicitly plan an HTTP-limit increase; preserve 64 MiB entry coverage and add an escape-heavy boundary test (also update the chunking decision at line 173).
Fixed the previously missed HTTP-limit issue in b79df7d. A chunk is cut where the next character would take its raw size past 3 MiB or its JSON-escaped size past 7 MiB. That keeps it under both the 4 MiB frame limit and the 8 MiB HTTP body. Escaping is deterministic, so cuts are stable. Each chunk carries at least 7/6 MiB raw, so 64 chunks cover at least 74 MiB, and 64 MiB completeness holds. A test uses a 64 MiB entry made only of U+001B and asserts no 413. The decision-log row is updated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed design, docs only. Nothing is built.
zerodb connect,zerodb doctor, and README storage guidance.refs, plus a local content-addressed object store for images, video and files, outside the tape.Each phase lists the assumptions and open questions to confirm before it starts. Also marked: