gunk-dev/the-valley

bd-c4d069b-git-churn-from-task-state.md

source221262c7b6f8main's published tip history
3.7 KiB · Rendered
1---
2type: bug
3id: bd-c4d069b
4status: open
5title: Storing high-frequency task and lease state in git produces merge churn and packfile bloat
6created: 2026-09-01
7source: knowledge base design review, 2026-09-01
8---
9
10# Storing task and lease state in git produces merge churn and bloat
11
12The knowledge graph architecture places all project knowledge—outcomes, decisions, bugs, ideas, and
13discussion threads—into markdown files versioned in git
14([architecture.md](../../design/architecture.md)). Sketches for autonomous agent execution
15([[ida-eac723e]], [[ida-3145b7a]]) propose using frontmatter status mutations (such as transitioning
16an outcome to `status: in-progress` with run leases and heartbeat timestamps) as the concurrency
17lock for dispatching work. Storing high-frequency task execution state, leases, and discussion
18comments directly in git commits produces severe merge conflicts and rapid packfile bloat as agent
19concurrency increases.
20
21## Why git is poorly suited for fine-grained task leases
22
23Git is designed for durable, content-addressed trees of source code committed at human or milestone
24granularity. It is not designed to serve as an in-flight job queue or distributed lock manager.
25
26Using git commits to manage agent scheduling encounters three concrete failure modes:
27
281. **Frontmatter merge conflicts.** If two agents concurrently update different fields on an outcome
29 node (for instance, one updating a lease expiration while another appends a blocking edge or
30 status note), standard three-way git merges frequently conflict on adjacent frontmatter lines.
31 These conflicts reject integration requests, stalling automated progress.
322. **Packfile and tree bloat.** High-frequency state transitions (e.g., `open` $\rightarrow$
33 `in-progress` $\rightarrow$ heartbeat lease renewal $\rightarrow$ `done`) commit hundreds of
34 transient tree objects into the repository. This inflates `.git` storage, increases clone times,
35 and degrades the performance of every local `git log` and `git status` command.
363. **Query latency at scale.** Finding the unblocked frontier requires reading frontmatter across
37 all files in `outcomes/`. While scanning files with `grep` or filesystem traversal works at fifty
38 nodes, evaluating complex DAG dependencies across thousands of historical task nodes imposes
39 substantial I/O overhead on every scheduler tick.
40
41## Why this is acceptable today
42
43The live outcome graph currently contains fewer than ten nodes, and all outcome state transitions
44are authored manually by the operator. Automated dispatchers (klaus) do not yet write leases or
45execution state to git. The issue is structural to the scheduling design and will emerge as soon as
46the Phase 4 agent dispatch loop is automated.
47
48## Directions, not decisions
49
50- **Separate ephemeral leases from durable milestones.** In-flight dispatch leases, heartbeat
51 tokens, and agent execution logs belong on an ephemeral, low-latency store—such as NATS JetStream
52 KV or memory—rather than in git commits.
53- **Git records only terminal milestones.** An outcome is updated in git only upon creation,
54 terminal completion (`done`), or abandonment (`abandoned`), eliminating high-frequency operational
55 churn from git history.
56- **Out-of-band discussion and thread storage.** Consider storing rapid discussion threads and agent
57 reasoning traces in a dedicated append-only log or thread namespace, rather than embedding every
58 reply as a separate revision of a root markdown file.
59
60## Related
61
62- Outcome DAG scheduler: [[ida-eac723e]]
63 ([ida-eac723e-outcome-dag.md](../ideas/ida-eac723e-outcome-dag.md))
64- Demand pressure and leases: [[ida-3145b7a]]
65 ([ida-3145b7a-demand-pressure.md](../ideas/ida-3145b7a-demand-pressure.md))
66- Project knowledge architecture: [architecture.md](../../design/architecture.md)