Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

Keep the shared claim ledger in the main checkout .graff

justrachf3900efb6b9d
diff --git a/scripts/eval/claim_ledger.py b/scripts/eval/claim_ledger.py
index 84df4db9..7b4788b8 100644
--- a/scripts/eval/claim_ledger.py
+++ b/scripts/eval/claim_ledger.py
@@ -11,4 +11,4 @@ def path(work: Path) -> Path:
root = Path(common)
if not root.is_absolute():
root = work / root
- return root / "artifact-claims.json"
+ return root.parent / ".graff" / "artifact-claims.json"
diff --git a/scripts/test-claim-repository.py b/scripts/test-claim-repository.py
index 5ee1aafb..af1156c4 100644
--- a/scripts/test-claim-repository.py
+++ b/scripts/test-claim-repository.py
@@ -65,7 +65,7 @@ class Model(ScriptedModel):
assert 'claim released' in json.dumps(body), body
(self.work/'release-done').touch()
if c.get('legacy') and step == 1:
- command = "python3 - <<'PYCLAIM'\nimport json, subprocess\nfrom pathlib import Path\ncommon=subprocess.check_output(['git','rev-parse','--git-common-dir'], text=True).strip()\np=Path(common)/'artifact-claims.json'\nrows=json.loads(p.read_text())\nfor row in rows: row.pop('repo',None)\np.write_text(json.dumps(rows))\nPYCLAIM"
+ command = "python3 - <<'PYCLAIM'\nimport json, subprocess\nfrom pathlib import Path\ncommon=subprocess.check_output(['git','rev-parse','--git-common-dir'], text=True).strip()\nroot=Path(common)\nif not root.is_absolute(): root=Path.cwd()/root\np=root.parent/'.graff'/'artifact-claims.json'\nrows=json.loads(p.read_text())\nfor row in rows: row.pop('repo',None)\np.write_text(json.dumps(rows))\nPYCLAIM"
return tool('bash', command=command)
if c.get('rebind') and step == 2:
return tool('peer_message', action='claim', kind=c.get('owner_kind','publication'), key=c['held'], repo=c['owner'])
diff --git a/src/artifact_claim_path.zig b/src/artifact_claim_path.zig
index f1f8deeb..231e6322 100644
--- a/src/artifact_claim_path.zig
+++ b/src/artifact_claim_path.zig
@@ -8,12 +8,12 @@ const ranOk = process_runner.ranOk;
pub const persist_rel = ".graff/artifact-claims.json";
-/// Shared file under the Git common dir. Empty when `cwd` is not a repo.
-/// Walks `.git` on disk so claim ops do not spawn `git` (Linux Threaded Io
-/// panics when two harnesses do that at once).
+/// Shared ledger: `<repo>/.graff/artifact-claims.json` of the main checkout
+/// (parent of the Git common dir). Linked worktrees share that file.
pub fn canonicalFile(arena: Allocator, io: Io, cwd: []const u8) ?[]const u8 {
const common = gitCommonDirWalk(arena, io, cwd) orelse return null;
- return std.fs.path.join(arena, &.{ common, "artifact-claims.json" }) catch null;
+ const root = std.fs.path.dirname(common) orelse return null;
+ return std.fs.path.join(arena, &.{ root, persist_rel }) catch null;
}
fn gitCommonDirWalk(arena: Allocator, io: Io, cwd: []const u8) ?[]const u8 {