feat: agent-driven export + cross-clone memory (v0.10.0)#12
Merged
Conversation
Two workflow gaps close in v0.10.0. A — Agent-driven sharing (no terminal hop): - export_memory MCP tool: reuses exportSync + shareToGit(push:false) to write .tre-mem/ and make a LOCAL commit; never pushes (returns the exact git push command). Fail-closed on secrets — returns matched categories, never the values, writes nothing. - get_share_status MCP tool: pending/shared/graduated counts. - graduate_fact result gains a `hint` nudging export_memory. B — Cross-clone memory by git remote (default-on; TRE_MEM_CROSS_CLONE=0 off): - Clones sharing remote.origin.url union their memory (branch tags, pins, graduated, observations). Read-time alias union, NOT a stored-key rewrite, so the committed .tre-mem/ format + SYNC_SCHEMA_VERSION are unchanged and teammates are unaffected. - New src/git/remote.ts (canonicalizeRemoteUrl, remoteSlug) and src/store/aliases.ts (resolveProjectIdentity, crossCloneEnabled). - Schema v3 (additive nullable branch_state.remote + index, self-healing). - repo: projectAliases, *Across(projects[]) readers, setRemoteForCwd, remoteForProject; adapter/retrieval refactored to project IN (...). - Any tre invocation eagerly registers the current clone's remote; web resolves aliases per requested project so the dashboard picker unions too. C — Visibility: - tre status prints remote: + linked clones (N): … - /api/health + /api/branches carry remote/linked_clones; topbar 🔗 N clones chip. Tests: git-remote, store-aliases, mcp-export-crossclone, v3 migration, repo alias/*Across; projects[] migration across adapter/retrieval/web/mcp fixtures. Full gate green: format · lint · typecheck · 366 tests · build.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
Two real-world gaps surfaced from daily use:
pin_fact/graduate_fact, the data only lived in the sidecar — publishing required dropping to a terminal fortre share. That one manual hop broke the "let the agent do it" flow.basename(cwd), soapp,app-2,app-3(parallel clones) were three isolated projects.What's in this PR
A — Agent-driven export (MCP)
export_memory— reusesexportSync+shareToGit({commit:true, push:false}): writes.tre-mem/and makes a local commit, never pushes (returns the exactgit push…command). Fail-closed on secrets: a blocked export returns the matched secret categories, never the values, and writes nothing.get_share_status— pending / shared / graduated counts so the agent can nudge you to export.graduate_factresult gains ahintpointing atexport_memory.B — Cross-clone memory by git remote (default-on;
TRE_MEM_CROSS_CLONE=0to disable)remote.origin.urlunion their memory (branch tags, pins, graduated facts, claude-mem observations).basename(cwd); reads expand toproject IN (alias set). Forced by constraints (claude-mem observations are permanently basename-keyed; committed.tre-mem/JSONL carriesproject). Payoff: on-disk format +SYNC_SCHEMA_VERSIONunchanged → zero teammate impact, one additive schema column.src/git/remote.ts(canonicalizeRemoteUrl→host/org/repo,remoteSlug) andsrc/store/aliases.ts(resolveProjectIdentity,crossCloneEnabled).branch_state.remote+ index, idempotent self-heal mirroring v2 (no backfill).repo:projectAliases,*Across(projects[])readers,setRemoteForCwd,remoteForProject; adapter/retrieval refactoredproject: string → projects: string[](= @project → IN (…)).treinvocation eagerly registers the current clone's remote; the web resolves aliases per requested project, so the dashboard picker unions correctly too (not just the daemon's home project).C — Visibility
tre statusprintsremote:andlinked clones (N): …./api/health+/api/branchescarryremote/linked_clones; dashboard topbar shows a🔗 N cloneschip.Test plan
format:check·lint·typecheck· 366 tests ·build— full pre-push gate greengit-remote,store-aliases,mcp-export-crossclone(export commit-no-push, redaction fail-closed, share-status, graduate hint, cross-clone surfacing + isolation), plus v3 migration + repo alias/*Acrosscasesprojects[]migration covered across adapter/retrieval/web/mcp fixturestre statusin agopsclone showslinked clones (4);/api/branches?project=go-ps-app-devreturns 4 linked clones / 20 unioned branchesTRE_MEM_CROSS_CLONE=0restores per-directory isolation.tre-mem/JSONL is byte-identical to pre-change output (teammate-safety)Notes
PLAN-PHASE7.md. Version0.9.0 → 0.10.0; CHANGELOG[0.10.0].