@flyingrobots/graft 0.3.5 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +386 -0
- package/CHANGELOG.md +69 -0
- package/CODE_OF_CONDUCT.md +65 -0
- package/README.md +153 -17
- package/bin/graft.js +4 -11
- package/docs/ADVANCED_GUIDE.md +49 -0
- package/docs/CLI.md +43 -0
- package/docs/GUIDE.md +321 -32
- package/docs/MCP.md +44 -0
- package/package.json +17 -4
- package/src/adapters/node-fs.ts +4 -0
- package/src/adapters/node-git.ts +47 -0
- package/src/adapters/node-process-runner.ts +27 -0
- package/src/cli/index-cmd.ts +86 -0
- package/src/cli/init.ts +808 -57
- package/src/cli/main.ts +437 -0
- package/src/contracts/capabilities.ts +341 -0
- package/src/contracts/causal-ontology.ts +622 -0
- package/src/contracts/causal-surface-next-action.ts +18 -0
- package/src/contracts/output-schemas.ts +1169 -0
- package/src/git/diff.ts +25 -21
- package/src/git/target-git-hook-bootstrap.ts +56 -0
- package/src/hooks/posttooluse-read.ts +21 -74
- package/src/hooks/pretooluse-read.ts +20 -56
- package/src/hooks/read-governor.ts +95 -0
- package/src/hooks/read-messages.ts +53 -0
- package/src/mcp/burden.ts +123 -0
- package/src/mcp/cache.ts +51 -0
- package/src/mcp/cached-file.ts +10 -8
- package/src/mcp/context.ts +67 -2
- package/src/mcp/daemon-control-plane.ts +554 -0
- package/src/mcp/daemon-job-scheduler.ts +279 -0
- package/src/mcp/daemon-repos.ts +216 -0
- package/src/mcp/daemon-server.ts +396 -0
- package/src/mcp/daemon-worker-pool.ts +310 -0
- package/src/mcp/daemon-worker-process.ts +52 -0
- package/src/mcp/metrics.ts +108 -1
- package/src/mcp/monitor-tick-job.ts +99 -0
- package/src/mcp/persisted-local-history.ts +1246 -0
- package/src/mcp/persistent-monitor-runtime.ts +549 -0
- package/src/mcp/policy.ts +84 -0
- package/src/mcp/receipt.ts +82 -12
- package/src/mcp/repo-concurrency.ts +318 -0
- package/src/mcp/repo-state.ts +777 -0
- package/src/mcp/repo-tool-job.ts +302 -0
- package/src/mcp/run-capture-config.ts +33 -0
- package/src/mcp/runtime-causal-context.ts +72 -0
- package/src/mcp/runtime-observability.ts +219 -0
- package/src/mcp/runtime-staged-target.ts +161 -0
- package/src/mcp/runtime-workspace-overlay.ts +255 -0
- package/src/mcp/semantic-transition-guidance.ts +60 -0
- package/src/mcp/semantic-transition-summary.ts +130 -0
- package/src/mcp/server.ts +704 -45
- package/src/mcp/stdio-server.ts +12 -0
- package/src/mcp/stdio.ts +2 -5
- package/src/mcp/tools/activity-view.ts +325 -0
- package/src/mcp/tools/causal-attach.ts +67 -0
- package/src/mcp/tools/causal-status.ts +58 -0
- package/src/mcp/tools/changed-since.ts +13 -11
- package/src/mcp/tools/code-find.ts +164 -0
- package/src/mcp/tools/code-refs.ts +466 -0
- package/src/mcp/tools/code-show.ts +252 -0
- package/src/mcp/tools/daemon-monitors.ts +14 -0
- package/src/mcp/tools/daemon-repos.ts +22 -0
- package/src/mcp/tools/daemon-sessions.ts +14 -0
- package/src/mcp/tools/daemon-status.ts +12 -0
- package/src/mcp/tools/doctor.ts +45 -2
- package/src/mcp/tools/explain.ts +4 -0
- package/src/mcp/tools/file-outline.ts +7 -3
- package/src/mcp/tools/git-files.ts +73 -0
- package/src/mcp/tools/graft-diff.ts +12 -4
- package/src/mcp/tools/map.ts +136 -0
- package/src/mcp/tools/monitor-pause.ts +18 -0
- package/src/mcp/tools/monitor-resume.ts +18 -0
- package/src/mcp/tools/monitor-start.ts +20 -0
- package/src/mcp/tools/monitor-stop.ts +18 -0
- package/src/mcp/tools/precision-match.ts +51 -0
- package/src/mcp/tools/precision-query.ts +127 -0
- package/src/mcp/tools/precision.ts +312 -0
- package/src/mcp/tools/run-capture.ts +126 -44
- package/src/mcp/tools/safe-read.ts +14 -12
- package/src/mcp/tools/since.ts +49 -0
- package/src/mcp/tools/state.ts +11 -3
- package/src/mcp/tools/stats.ts +5 -1
- package/src/mcp/tools/workspace-authorizations.ts +14 -0
- package/src/mcp/tools/workspace-authorize.ts +20 -0
- package/src/mcp/tools/workspace-bind.ts +25 -0
- package/src/mcp/tools/workspace-rebind.ts +25 -0
- package/src/mcp/tools/workspace-revoke.ts +18 -0
- package/src/mcp/tools/workspace-status.ts +12 -0
- package/src/mcp/warp-pool.ts +36 -0
- package/src/mcp/workspace-router.ts +984 -0
- package/src/operations/file-outline.ts +12 -2
- package/src/operations/graft-diff.ts +56 -10
- package/src/operations/safe-read.ts +27 -4
- package/src/operations/state.ts +6 -9
- package/src/parser/lang.ts +19 -3
- package/src/parser/outline.ts +191 -2
- package/src/parser/types.ts +9 -1
- package/src/policy/types.ts +4 -3
- package/src/ports/filesystem.ts +1 -0
- package/src/ports/git.ts +16 -0
- package/src/ports/process-runner.ts +22 -0
- package/src/release/security-gate.ts +102 -0
- package/src/session/tracker.ts +31 -0
- package/src/version.ts +3 -0
- package/src/warp/indexer.ts +513 -0
- package/src/warp/observers.ts +105 -0
- package/src/warp/open.ts +31 -0
- package/src/warp/plumbing.d.ts +15 -0
- package/src/warp/writer-id.ts +30 -0
package/ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
# Graft Architecture
|
|
2
|
+
|
|
3
|
+
This document is the contributor-facing system map for Graft. It sits
|
|
4
|
+
between the operator docs in `README.md` / `docs/GUIDE.md` and the
|
|
5
|
+
directional docs in `docs/BEARING.md` / `docs/VISION.md`.
|
|
6
|
+
|
|
7
|
+
If you need the shortest possible summary:
|
|
8
|
+
|
|
9
|
+
- **CLI** is the human/debug surface.
|
|
10
|
+
- **MCP** is the primary agent surface.
|
|
11
|
+
- **Hooks** are a Claude-side safety net for native `Read`.
|
|
12
|
+
- **Policy** decides what kind of read is allowed.
|
|
13
|
+
- **Repo state** gives layered worldline context about the current
|
|
14
|
+
checkout and working tree.
|
|
15
|
+
- **WARP** stores and serves structural history over Git.
|
|
16
|
+
|
|
17
|
+
## Product surfaces
|
|
18
|
+
|
|
19
|
+
### CLI
|
|
20
|
+
|
|
21
|
+
Runtime entry:
|
|
22
|
+
- [graft.js](/Users/james/git/graft/bin/graft.js)
|
|
23
|
+
- [main.ts](/Users/james/git/graft/src/cli/main.ts)
|
|
24
|
+
|
|
25
|
+
Purpose:
|
|
26
|
+
- human-facing debugging
|
|
27
|
+
- local testing of MCP peer commands
|
|
28
|
+
- bootstrap and admin commands such as `init` and `index`
|
|
29
|
+
|
|
30
|
+
Current shape:
|
|
31
|
+
- `graft` with no args prints help for humans
|
|
32
|
+
- `graft serve` starts the stdio MCP server explicitly
|
|
33
|
+
- grouped namespaces mirror the core MCP surface:
|
|
34
|
+
- `read`
|
|
35
|
+
- `struct`
|
|
36
|
+
- `symbol`
|
|
37
|
+
- `diag`
|
|
38
|
+
|
|
39
|
+
The CLI is intentionally not the primary product contract. It exists so
|
|
40
|
+
operators and contributors can inspect the same bounded surfaces without
|
|
41
|
+
having to attach a separate MCP client.
|
|
42
|
+
|
|
43
|
+
### MCP
|
|
44
|
+
|
|
45
|
+
Runtime entry:
|
|
46
|
+
- [server.ts](/Users/james/git/graft/src/mcp/server.ts)
|
|
47
|
+
- [stdio.ts](/Users/james/git/graft/src/mcp/stdio.ts)
|
|
48
|
+
- [stdio-server.ts](/Users/james/git/graft/src/mcp/stdio-server.ts)
|
|
49
|
+
|
|
50
|
+
Purpose:
|
|
51
|
+
- primary agent surface
|
|
52
|
+
- structured tool responses with receipts and versioned `_schema`
|
|
53
|
+
metadata
|
|
54
|
+
- policy-aware bounded read access
|
|
55
|
+
|
|
56
|
+
Current shape:
|
|
57
|
+
- `graft serve` runs one repo-rooted stdio server per process
|
|
58
|
+
- `graft daemon` runs one local daemon host per process and many daemon
|
|
59
|
+
sessions beneath it
|
|
60
|
+
- daemon mode now includes a central authorization and inspection
|
|
61
|
+
control plane for workspaces and sessions
|
|
62
|
+
- daemon mode now also includes one repo-scoped persistent monitor
|
|
63
|
+
runtime per canonical repo, currently used for background incremental
|
|
64
|
+
WARP indexing
|
|
65
|
+
- each server or daemon session owns one `SessionTracker`,
|
|
66
|
+
`ObservationCache`, `Metrics`, and `RepoStateTracker` slice
|
|
67
|
+
- lazy WARP initialization still happens only when a WARP-backed tool
|
|
68
|
+
needs it
|
|
69
|
+
|
|
70
|
+
This is now enough to make the local daemon and first monitor contract
|
|
71
|
+
real without pretending the broader system-wide story is finished.
|
|
72
|
+
|
|
73
|
+
### Hooks
|
|
74
|
+
|
|
75
|
+
Runtime entry:
|
|
76
|
+
- [pretooluse-read.ts](/Users/james/git/graft/src/hooks/pretooluse-read.ts)
|
|
77
|
+
- [posttooluse-read.ts](/Users/james/git/graft/src/hooks/posttooluse-read.ts)
|
|
78
|
+
- [shared.ts](/Users/james/git/graft/src/hooks/shared.ts)
|
|
79
|
+
|
|
80
|
+
Purpose:
|
|
81
|
+
- govern Claude Code native `Read` calls when the agent bypasses graft's
|
|
82
|
+
MCP tools
|
|
83
|
+
- block obviously banned reads before they happen
|
|
84
|
+
- show what `safe_read` would have returned after a native read
|
|
85
|
+
|
|
86
|
+
Hooks are not the full product surface. They are a safety rail around a
|
|
87
|
+
host tool that Graft does not control directly.
|
|
88
|
+
|
|
89
|
+
## Request flow
|
|
90
|
+
|
|
91
|
+
The normal happy path for an MCP tool looks like this:
|
|
92
|
+
|
|
93
|
+
1. A client calls a tool such as `safe_read`.
|
|
94
|
+
2. [server.ts](/Users/james/git/graft/src/mcp/server.ts) validates the
|
|
95
|
+
input with Zod when the tool declares a schema.
|
|
96
|
+
3. The server records session/tool metrics and refreshes repo-state
|
|
97
|
+
observation.
|
|
98
|
+
4. If the tool is marked `policyCheck: true`, middleware performs a
|
|
99
|
+
path-based precheck before the handler runs.
|
|
100
|
+
5. The tool handler executes with a shared
|
|
101
|
+
[ToolContext](/Users/james/git/graft/src/mcp/context.ts).
|
|
102
|
+
6. The handler returns data through `ctx.respond(...)`.
|
|
103
|
+
7. [receipt.ts](/Users/james/git/graft/src/mcp/receipt.ts) attaches
|
|
104
|
+
`_receipt` and versioned `_schema` metadata.
|
|
105
|
+
|
|
106
|
+
That flow is the key architectural rule: handlers should compose shared
|
|
107
|
+
infrastructure rather than doing their own ad hoc parsing, shaping, and
|
|
108
|
+
serialization.
|
|
109
|
+
|
|
110
|
+
## Shared policy seam
|
|
111
|
+
|
|
112
|
+
Core modules:
|
|
113
|
+
- [evaluate.ts](/Users/james/git/graft/src/policy/evaluate.ts)
|
|
114
|
+
- [graftignore.ts](/Users/james/git/graft/src/policy/graftignore.ts)
|
|
115
|
+
- [policy.ts](/Users/james/git/graft/src/mcp/policy.ts)
|
|
116
|
+
|
|
117
|
+
Policy is the heart of Graft. It decides:
|
|
118
|
+
- whether content is allowed at all
|
|
119
|
+
- whether content should be returned as full text, outline, diff, or
|
|
120
|
+
refusal
|
|
121
|
+
- whether session depth or budget should tighten the response
|
|
122
|
+
- whether `.graftignore` suppresses the path entirely
|
|
123
|
+
|
|
124
|
+
Important distinction:
|
|
125
|
+
- `src/policy/*` holds the domain logic
|
|
126
|
+
- `src/mcp/policy.ts` adapts that domain logic to the MCP runtime
|
|
127
|
+
contract
|
|
128
|
+
|
|
129
|
+
The repo’s current doctrine is that bounded-read surfaces should share
|
|
130
|
+
one policy contract across:
|
|
131
|
+
- MCP tools
|
|
132
|
+
- CLI peers
|
|
133
|
+
- hooks
|
|
134
|
+
- working-tree and git-backed structural reads
|
|
135
|
+
|
|
136
|
+
One explicit exception remains:
|
|
137
|
+
- `run_capture` is a shell escape hatch outside the bounded-read policy
|
|
138
|
+
contract, and it declares that explicitly through `policyBoundary`
|
|
139
|
+
|
|
140
|
+
## Layered worldline model
|
|
141
|
+
|
|
142
|
+
Core module:
|
|
143
|
+
- [repo-state.ts](/Users/james/git/graft/src/mcp/repo-state.ts)
|
|
144
|
+
|
|
145
|
+
Graft no longer treats “current repo state” as a single flat idea. The
|
|
146
|
+
MCP surface now distinguishes three layers:
|
|
147
|
+
|
|
148
|
+
- `commit_worldline`
|
|
149
|
+
- durable history grounded in commits
|
|
150
|
+
- `ref_view`
|
|
151
|
+
- branch/ref comparisons over that durable history
|
|
152
|
+
- `workspace_overlay`
|
|
153
|
+
- the current dirty working tree and checkout state
|
|
154
|
+
|
|
155
|
+
`RepoStateTracker` infers lightweight semantic transitions such as:
|
|
156
|
+
- `checkout`
|
|
157
|
+
- `reset`
|
|
158
|
+
- `merge`
|
|
159
|
+
- `rebase`
|
|
160
|
+
|
|
161
|
+
The current implementation is tool-call-driven, not watcher-driven. In
|
|
162
|
+
other words, repo-state is refreshed between requests, not from a
|
|
163
|
+
continuous filesystem daemon yet.
|
|
164
|
+
|
|
165
|
+
This is also where the current architecture still shows strain:
|
|
166
|
+
- raw git process access
|
|
167
|
+
- status/reflog parsing
|
|
168
|
+
- transition inference
|
|
169
|
+
- observation shaping
|
|
170
|
+
|
|
171
|
+
all still live in one module. That is why `repo-state` remains a known
|
|
172
|
+
cleanup hotspot in backlog.
|
|
173
|
+
|
|
174
|
+
## WARP: write path vs read path
|
|
175
|
+
|
|
176
|
+
### Write path
|
|
177
|
+
|
|
178
|
+
Core modules:
|
|
179
|
+
- [indexer.ts](/Users/james/git/graft/src/warp/indexer.ts)
|
|
180
|
+
- [open.ts](/Users/james/git/graft/src/warp/open.ts)
|
|
181
|
+
|
|
182
|
+
The write side turns Git history into structural graph facts.
|
|
183
|
+
|
|
184
|
+
High-level flow:
|
|
185
|
+
1. open a WARP graph backed by Git plumbing
|
|
186
|
+
2. enumerate commits to index
|
|
187
|
+
3. compute changed files for each commit
|
|
188
|
+
4. extract structural outlines and diffs
|
|
189
|
+
5. write structural patch facts into the graph
|
|
190
|
+
|
|
191
|
+
This is the “materialize history into structure” side of Graft.
|
|
192
|
+
|
|
193
|
+
### Read path
|
|
194
|
+
|
|
195
|
+
Core modules:
|
|
196
|
+
- [observers.ts](/Users/james/git/graft/src/warp/observers.ts)
|
|
197
|
+
- [precision.ts](/Users/james/git/graft/src/mcp/tools/precision.ts)
|
|
198
|
+
- [graft-diff.ts](/Users/james/git/graft/src/mcp/tools/graft-diff.ts)
|
|
199
|
+
- [since.ts](/Users/james/git/graft/src/mcp/tools/since.ts)
|
|
200
|
+
- [map.ts](/Users/james/git/graft/src/mcp/tools/map.ts)
|
|
201
|
+
|
|
202
|
+
The read side does not traverse graph internals by hand. Instead it
|
|
203
|
+
uses the Observer Law:
|
|
204
|
+
|
|
205
|
+
- write facts into WARP
|
|
206
|
+
- read projections through observers/lenses
|
|
207
|
+
- keep graph traversal knowledge localized
|
|
208
|
+
|
|
209
|
+
This is why [observers.ts](/Users/james/git/graft/src/warp/observers.ts)
|
|
210
|
+
is small but important. It is the canonical read vocabulary for the
|
|
211
|
+
graph.
|
|
212
|
+
|
|
213
|
+
## Parser and operations layer
|
|
214
|
+
|
|
215
|
+
Core modules:
|
|
216
|
+
- [lang.ts](/Users/james/git/graft/src/parser/lang.ts)
|
|
217
|
+
- [outline.ts](/Users/james/git/graft/src/parser/outline.ts)
|
|
218
|
+
- [diff.ts](/Users/james/git/graft/src/parser/diff.ts)
|
|
219
|
+
- [safe-read.ts](/Users/james/git/graft/src/operations/safe-read.ts)
|
|
220
|
+
- [file-outline.ts](/Users/james/git/graft/src/operations/file-outline.ts)
|
|
221
|
+
- [read-range.ts](/Users/james/git/graft/src/operations/read-range.ts)
|
|
222
|
+
- [graft-diff.ts](/Users/james/git/graft/src/operations/graft-diff.ts)
|
|
223
|
+
|
|
224
|
+
This layer is where Graft turns files into structural meaning.
|
|
225
|
+
|
|
226
|
+
Responsibilities:
|
|
227
|
+
- detect supported languages
|
|
228
|
+
- extract outlines and jump tables
|
|
229
|
+
- compute structural diffs
|
|
230
|
+
- implement bounded read behavior independently of transport
|
|
231
|
+
|
|
232
|
+
This separation matters because it lets MCP, CLI, and tests share the
|
|
233
|
+
same behavior without duplicating core logic.
|
|
234
|
+
|
|
235
|
+
## Ports and adapters
|
|
236
|
+
|
|
237
|
+
Ports:
|
|
238
|
+
- [filesystem.ts](/Users/james/git/graft/src/ports/filesystem.ts)
|
|
239
|
+
- [codec.ts](/Users/james/git/graft/src/ports/codec.ts)
|
|
240
|
+
|
|
241
|
+
Adapters:
|
|
242
|
+
- [node-fs.ts](/Users/james/git/graft/src/adapters/node-fs.ts)
|
|
243
|
+
- [canonical-json.ts](/Users/james/git/graft/src/adapters/canonical-json.ts)
|
|
244
|
+
|
|
245
|
+
Graft is not purely hexagonal everywhere, but it does follow the
|
|
246
|
+
pattern in important places:
|
|
247
|
+
- core logic avoids reaching straight into `node:fs` when a stable port
|
|
248
|
+
exists
|
|
249
|
+
- JSON shaping/serialization is pushed through a codec boundary
|
|
250
|
+
- shared runtime dependencies are injected through `ToolContext`
|
|
251
|
+
|
|
252
|
+
The largest remaining hexagonal gap is process execution. Git and shell
|
|
253
|
+
work still happen through direct subprocess calls in a few hotspots,
|
|
254
|
+
which is already tracked in backlog.
|
|
255
|
+
|
|
256
|
+
## Session, cache, receipts
|
|
257
|
+
|
|
258
|
+
Core modules:
|
|
259
|
+
- [tracker.ts](/Users/james/git/graft/src/session/tracker.ts)
|
|
260
|
+
- [cache.ts](/Users/james/git/graft/src/mcp/cache.ts)
|
|
261
|
+
- [cached-file.ts](/Users/james/git/graft/src/mcp/cached-file.ts)
|
|
262
|
+
- [receipt.ts](/Users/james/git/graft/src/mcp/receipt.ts)
|
|
263
|
+
- [metrics.ts](/Users/james/git/graft/src/mcp/metrics.ts)
|
|
264
|
+
|
|
265
|
+
These modules are what make Graft a governor instead of just a fancy
|
|
266
|
+
file reader.
|
|
267
|
+
|
|
268
|
+
They provide:
|
|
269
|
+
- session-depth awareness
|
|
270
|
+
- budget tracking
|
|
271
|
+
- tripwires
|
|
272
|
+
- re-read suppression
|
|
273
|
+
- structural diffs for changed files
|
|
274
|
+
- cumulative metrics
|
|
275
|
+
- response receipts and schema metadata
|
|
276
|
+
|
|
277
|
+
In practice:
|
|
278
|
+
- policy decides *what* can be returned
|
|
279
|
+
- cache/session/metrics decide *how expensive and how repeated* the
|
|
280
|
+
interaction has become
|
|
281
|
+
|
|
282
|
+
## Current architectural tensions
|
|
283
|
+
|
|
284
|
+
The repo has a clear shape, but a few real tensions remain:
|
|
285
|
+
|
|
286
|
+
1. **Repo-scoped stdio server vs shared daemon future**
|
|
287
|
+
- current MCP shape assumes one rooted context per process
|
|
288
|
+
- future system-wide use needs explicit repo/worktree/session binding
|
|
289
|
+
|
|
290
|
+
2. **Daemon/system-wide seams are still broader than they should be**
|
|
291
|
+
- filesystem, codec, git, and process ports now exist
|
|
292
|
+
- daemon hosting, control-plane projection, and monitor orchestration
|
|
293
|
+
still want narrower seams before more system-wide behavior lands
|
|
294
|
+
|
|
295
|
+
3. **Docs and direction are strong, contributor map was missing**
|
|
296
|
+
- this file exists to close exactly that gap
|
|
297
|
+
|
|
298
|
+
## Daemon evolution path
|
|
299
|
+
|
|
300
|
+
Current repo-local path:
|
|
301
|
+
|
|
302
|
+
- `graft serve` starts one repo-rooted stdio server
|
|
303
|
+
- `startStdioServer(cwd)` passes that cwd into `createGraftServer()`
|
|
304
|
+
- one process holds one rooted `SessionTracker`, `ObservationCache`,
|
|
305
|
+
`Metrics`, and `RepoStateTracker`
|
|
306
|
+
|
|
307
|
+
Current local shared-daemon path:
|
|
308
|
+
|
|
309
|
+
- `graft daemon` owns local-only transport and session lifecycle
|
|
310
|
+
- daemon sessions start unbound
|
|
311
|
+
- a daemon-only workspace bind step resolves repo/worktree identity
|
|
312
|
+
server-side before repo-scoped tools run
|
|
313
|
+
- MCP traffic lives at `/mcp`, and liveness lives at `/healthz`
|
|
314
|
+
- each daemon transport session owns its own daemon-mode MCP server
|
|
315
|
+
- state splits cleanly across:
|
|
316
|
+
- canonical repo identity and default WARP ownership (`git common
|
|
317
|
+
dir`)
|
|
318
|
+
- live worktree identity (resolved worktree root)
|
|
319
|
+
- session-local cache, budget, receipts, and saved state
|
|
320
|
+
- one repo-scoped WARP instance per canonical repo remains the default
|
|
321
|
+
assumption even if several daemon sessions or worktrees bind into that
|
|
322
|
+
repo
|
|
323
|
+
|
|
324
|
+
This split is the bridge from repo-local stdio to a same-user local
|
|
325
|
+
daemon without pretending control-plane and multi-repo concerns are
|
|
326
|
+
already solved.
|
|
327
|
+
|
|
328
|
+
## Multi-repo coordination contract
|
|
329
|
+
|
|
330
|
+
The current daemon can now be described lawfully in system-wide terms:
|
|
331
|
+
|
|
332
|
+
- canonical repo identity is keyed by `git common dir`
|
|
333
|
+
- live worktree identity is keyed by resolved worktree root
|
|
334
|
+
- daemon session identity remains transport-scoped and session-local
|
|
335
|
+
|
|
336
|
+
The architectural rule is:
|
|
337
|
+
|
|
338
|
+
- repo-scoped truth may be coordinated system-wide
|
|
339
|
+
- worktree-scoped truth may be projected beneath a repo
|
|
340
|
+
- session-scoped truth must not silently become daemon-global state
|
|
341
|
+
|
|
342
|
+
The current multi-repo overview surface now shows:
|
|
343
|
+
|
|
344
|
+
- one bounded row per authorized canonical repo through `daemon_repos`
|
|
345
|
+
- compact worktree, session-count, monitor, backlog, and last-activity
|
|
346
|
+
summaries
|
|
347
|
+
- filtered drill-down derived from the authorization registry and
|
|
348
|
+
daemon-owned runtime state
|
|
349
|
+
|
|
350
|
+
Follow-on system-wide work may still add:
|
|
351
|
+
|
|
352
|
+
- daemon-wide fairness and resource-pressure summaries
|
|
353
|
+
- broader aggregate counts across many repos and worker kinds
|
|
354
|
+
|
|
355
|
+
What it must not show by default:
|
|
356
|
+
|
|
357
|
+
- raw receipt bodies
|
|
358
|
+
- cache content
|
|
359
|
+
- saved state content
|
|
360
|
+
- runtime-log payloads
|
|
361
|
+
- shell-output artifacts
|
|
362
|
+
|
|
363
|
+
This keeps multi-repo coordination observational and authorization-
|
|
364
|
+
filtered instead of turning it into an accidental side channel or a
|
|
365
|
+
permission grant.
|
|
366
|
+
|
|
367
|
+
## Where to read next
|
|
368
|
+
|
|
369
|
+
If you are onboarding as a contributor:
|
|
370
|
+
|
|
371
|
+
1. Read [README.md](/Users/james/git/graft/README.md) for the product
|
|
372
|
+
claim.
|
|
373
|
+
2. Read [docs/GUIDE.md](/Users/james/git/graft/docs/GUIDE.md) for the
|
|
374
|
+
operator setup surface.
|
|
375
|
+
3. Read [docs/BEARING.md](/Users/james/git/graft/docs/BEARING.md) for
|
|
376
|
+
current direction and readiness bars.
|
|
377
|
+
4. Read [METHOD.md](/Users/james/git/graft/METHOD.md) for local process.
|
|
378
|
+
5. Then open:
|
|
379
|
+
- [server.ts](/Users/james/git/graft/src/mcp/server.ts)
|
|
380
|
+
- [repo-state.ts](/Users/james/git/graft/src/mcp/repo-state.ts)
|
|
381
|
+
- [evaluate.ts](/Users/james/git/graft/src/policy/evaluate.ts)
|
|
382
|
+
- [indexer.ts](/Users/james/git/graft/src/warp/indexer.ts)
|
|
383
|
+
- [observers.ts](/Users/james/git/graft/src/warp/observers.ts)
|
|
384
|
+
|
|
385
|
+
That sequence gives the clearest current picture of how the system
|
|
386
|
+
actually works.
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,75 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
7
7
|
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- **`code_find` approximate discovery**: plain-text queries now use
|
|
13
|
+
case-insensitive exact/prefix/substring matching with deterministic
|
|
14
|
+
ranking. Explicit glob queries such as `handle*` keep the existing
|
|
15
|
+
glob behavior.
|
|
16
|
+
- **Claude hook governed reads**: `PreToolUse` now redirects large
|
|
17
|
+
JS/TS native `Read` calls to graft's bounded-read path before the
|
|
18
|
+
full file lands in context. `PostToolUse` remains a backstop message
|
|
19
|
+
for oversized code reads that still slip through.
|
|
20
|
+
- **Codex bootstrap posture**: `graft init --write-codex-mcp` now seeds
|
|
21
|
+
`AGENTS.md` alongside `.codex/config.toml`, and the setup docs now
|
|
22
|
+
distinguish MCP availability from actual governed-read posture by
|
|
23
|
+
client.
|
|
24
|
+
- **MCP runtime observability**: MCP sessions now emit metadata-only
|
|
25
|
+
session/tool-call/failure events to `.graft/logs/mcp-runtime.ndjson`,
|
|
26
|
+
receipts carry `traceId` and `latencyMs`, and `doctor` reports the
|
|
27
|
+
active runtime log posture.
|
|
28
|
+
|
|
29
|
+
## [0.5.0] - 2026-04-11
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
- **Between-commit activity view**: new bounded `activity_view` MCP
|
|
34
|
+
tool and `graft diag activity` CLI peer surface for inspecting
|
|
35
|
+
recent local `artifact_history` around the active causal workspace.
|
|
36
|
+
- **Persisted local history substrate**: continuity, attribution,
|
|
37
|
+
staged-target, transition, and recent read/stage activity now
|
|
38
|
+
survive across local sessions as bounded artifact history.
|
|
39
|
+
- **Same-repo concurrency posture**: bounded `repoConcurrency`
|
|
40
|
+
summaries and lawful same-worktree cross-session handoff semantics.
|
|
41
|
+
|
|
42
|
+
### Changed
|
|
43
|
+
|
|
44
|
+
- **Reactive workspace footing**: checkout-boundary footing, hook
|
|
45
|
+
posture, and forked-vs-stable lineage are now explicit product truth
|
|
46
|
+
instead of implied inference.
|
|
47
|
+
- **Semantic transitions**: bounded surfaces now summarize
|
|
48
|
+
`index_update`, `conflict_resolution`, `merge_phase`,
|
|
49
|
+
`rebase_phase`, `bulk_transition`, and lawful `unknown` with
|
|
50
|
+
transition-aware guidance.
|
|
51
|
+
- **Signpost docs**: README, GUIDE, BEARING, VISION, release notes,
|
|
52
|
+
and the new CLI/MCP/advanced signposts now reflect the 0.5.0
|
|
53
|
+
release cut.
|
|
54
|
+
|
|
55
|
+
## [0.4.0] - 2026-04-05
|
|
56
|
+
|
|
57
|
+
### Added
|
|
58
|
+
|
|
59
|
+
- **WARP Level 1 — structural memory substrate**: git-warp-backed
|
|
60
|
+
graph stores structural facts per commit. Directory tree, file,
|
|
61
|
+
symbol, and commit nodes with containment edges and provenance
|
|
62
|
+
links (touches, adds, changes, removes).
|
|
63
|
+
- **`graft_since`**: structural changes since a git ref — symbols
|
|
64
|
+
added, removed, and changed per file with summary lines. Instant.
|
|
65
|
+
- **`graft_map`**: structural map of a directory — all files and
|
|
66
|
+
their symbols in one call via tree-sitter.
|
|
67
|
+
- **`graft index` CLI**: manual WARP indexing trigger.
|
|
68
|
+
- **WARP indexer**: walks git history, parses files with tree-sitter,
|
|
69
|
+
emits WARP patches. Handles nested symbols, file deletion,
|
|
70
|
+
signature changes, unsupported language degradation.
|
|
71
|
+
- **Observer factory**: 8 canonical lens patterns for focused graph
|
|
72
|
+
projections (file symbols, all symbols, directory files, etc.).
|
|
73
|
+
- **11 WARP invariants**: observer-only-access, materialization-
|
|
74
|
+
deterministic, delta-only-storage, address-not-identity, and more.
|
|
75
|
+
- **`@git-stunts/git-warp` v16** + `@git-stunts/plumbing` deps.
|
|
76
|
+
|
|
8
77
|
## [0.3.5] - 2026-04-05
|
|
9
78
|
|
|
10
79
|
### Fixed
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
Graft is a public developer tool project. Participation in this
|
|
4
|
+
repository, its issue tracker, pull requests, discussions, and other
|
|
5
|
+
project spaces should be respectful, constructive, and professional.
|
|
6
|
+
|
|
7
|
+
## Expected behavior
|
|
8
|
+
|
|
9
|
+
Participants are expected to:
|
|
10
|
+
|
|
11
|
+
- assume good intent while still being direct about technical concerns
|
|
12
|
+
- give feedback that is specific, evidence-based, and useful
|
|
13
|
+
- respect differences in experience level, background, and viewpoint
|
|
14
|
+
- keep disagreements focused on ideas, code, design, or process
|
|
15
|
+
- accept correction gracefully when impact is pointed out
|
|
16
|
+
|
|
17
|
+
## Unacceptable behavior
|
|
18
|
+
|
|
19
|
+
The following behavior is not acceptable in project spaces:
|
|
20
|
+
|
|
21
|
+
- harassment, intimidation, threats, or sustained hostility
|
|
22
|
+
- personal attacks, insults, or demeaning language
|
|
23
|
+
- discrimination based on personal characteristics or identity
|
|
24
|
+
- sexualized language or unwanted sexual attention
|
|
25
|
+
- doxxing, sharing private information, or encouraging others to do so
|
|
26
|
+
- trolling, deliberate disruption, or bad-faith escalation
|
|
27
|
+
- retaliation against someone who reports a conduct concern
|
|
28
|
+
|
|
29
|
+
## Scope
|
|
30
|
+
|
|
31
|
+
This code of conduct applies in:
|
|
32
|
+
|
|
33
|
+
- GitHub issues, pull requests, discussions, and reviews
|
|
34
|
+
- project chat or coordination spaces, if any
|
|
35
|
+
- any public interaction where someone is representing the Graft
|
|
36
|
+
project
|
|
37
|
+
|
|
38
|
+
## Reporting
|
|
39
|
+
|
|
40
|
+
If you experience or witness unacceptable behavior, report it to the
|
|
41
|
+
maintainer:
|
|
42
|
+
|
|
43
|
+
- `james@flyingrobots.dev`
|
|
44
|
+
|
|
45
|
+
Please include as much context as you can, including links, screenshots,
|
|
46
|
+
or timestamps when available.
|
|
47
|
+
|
|
48
|
+
## Enforcement
|
|
49
|
+
|
|
50
|
+
Reports will be reviewed promptly and handled as fairly as possible.
|
|
51
|
+
Responses may include:
|
|
52
|
+
|
|
53
|
+
- clarification or warning
|
|
54
|
+
- moderation of comments or discussion
|
|
55
|
+
- removal of content
|
|
56
|
+
- temporary or permanent exclusion from project spaces
|
|
57
|
+
|
|
58
|
+
The maintainer may take any action needed to protect participants and
|
|
59
|
+
the project.
|
|
60
|
+
|
|
61
|
+
## Project standard
|
|
62
|
+
|
|
63
|
+
This document is intentionally concise. The standard is simple: be
|
|
64
|
+
respectful, stay constructive, and do not make project participation
|
|
65
|
+
unsafe for other people.
|