| 1 | --- |
| 2 | type: bug |
| 3 | id: bd-c4d069b |
| 4 | status: open |
| 5 | title: Storing high-frequency task and lease state in git produces merge churn and packfile bloat |
| 6 | created: 2026-09-01 |
| 7 | source: knowledge base design review, 2026-09-01 |
| 8 | --- |
| 9 | |
| 10 | # Storing task and lease state in git produces merge churn and bloat |
| 11 | |
| 12 | The knowledge graph architecture places all project knowledge—outcomes, decisions, bugs, ideas, and |
| 13 | discussion 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 |
| 16 | an outcome to `status: in-progress` with run leases and heartbeat timestamps) as the concurrency |
| 17 | lock for dispatching work. Storing high-frequency task execution state, leases, and discussion |
| 18 | comments directly in git commits produces severe merge conflicts and rapid packfile bloat as agent |
| 19 | concurrency increases. |
| 20 | |
| 21 | ## Why git is poorly suited for fine-grained task leases |
| 22 | |
| 23 | Git is designed for durable, content-addressed trees of source code committed at human or milestone |
| 24 | granularity. It is not designed to serve as an in-flight job queue or distributed lock manager. |
| 25 | |
| 26 | Using git commits to manage agent scheduling encounters three concrete failure modes: |
| 27 | |
| 28 | 1. **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. |
| 32 | 2. **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. |
| 36 | 3. **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 | |
| 43 | The live outcome graph currently contains fewer than ten nodes, and all outcome state transitions |
| 44 | are authored manually by the operator. Automated dispatchers (klaus) do not yet write leases or |
| 45 | execution state to git. The issue is structural to the scheduling design and will emerge as soon as |
| 46 | the 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) |