gunk-dev/the-valley

knowledge.md

source3c6a9dad07a1main's published tip history
7.1 KiB · Rendered
1# Project knowledge
2
3A unified, git-native, markdown-based knowledge graph for everything in a project that isn't executable code and isn't user-facing documentation: bugs, ideas, principles, decisions, retrospectives, tasks, threads. Equally consumable by humans and AI agents.
4
5Supersedes the original "issues" scope. Issue tracking is one slice of this; treating it in isolation misses the larger problem — a project's institutional knowledge has no good home today and is invisible to agents.
6
7## Core model
8
9Every artifact is a **typed node**, stored as a single markdown file:
10
11- **Frontmatter (YAML)** carries the structured layer: type, id, status, typed edges, type-specific fields. This is the source of truth for the graph.
12- **Body (markdown)** carries prose. `[[id]]` references in the body are *human ergonomics only* — hyperlinks for editors that render them, grep targets for humans. They are not parsed into edges.
13
14Single source of truth for the graph (frontmatter); no parser magic; agents and tooling read structured data without ambiguity.
15
16## Layout
17
18```
19.the-valley/
20 bugs/ bd-*.md
21 principles/ prn-*.md
22 decisions/ dcr-*.md
23 retros/ rtr-*.md
24 ideas/ ida-*.md
25 tasks/ tsk-*.md
26 threads/ thr-*.md
27 schemas/ scm-*.cue
28```
29
30Lives at the root of each repo. Gets cloned with the code. No special storage.
31
32IDs are short, hash-derived, type-prefixed (`bd-a3f2`). Type is inferable from the prefix without parsing.
33
34## Examples
35
36**A bug:**
37
38```markdown
39---
40type: bug
41id: bd-a3f2
42title: Race in integrator queue on same-target requests
43status: open
44severity: high
45created_at: 2026-05-17T10:00:00Z
46created_by: ssh:SHA256:abc...
47blocked_by: [bd-9c1d]
48blocks: []
49related_to: [prn-002]
50---
51
52When two integration-requested events arrive concurrently for the same
53target ref, the dequeue logic has a window where both can be picked up by
54parallel handlers. See [[thr-2026-05-17-integrator-race]].
55```
56
57**A principle:**
58
59```markdown
60---
61type: principle
62id: prn-002
63title: Local checks must be reproducible
64status: active
65applies_to: [verification, contribute]
66enforced_by: [check:reproducibility-audit]
67---
68
69All canonical derivations must be bit-reproducible. The reproducibility-audit
70check runs nightly and emits a divergence event on drift. Reproducibility is
71the prerequisite for transparency log witnessing — without it, the witness's
72"I got hash X" matches nobody.
73
74See [[verification.md]] for detail.
75```
76
77## Typed edges (declared in frontmatter)
78
79The vocabulary differs per node type; common edges:
80
81| Edge | Meaning |
82| --- | --- |
83| `blocks` / `blocked_by` | Work-layer dependency |
84| `related_to` | Untyped reference; "see also" |
85| `supersedes` / `superseded_by` | Replaces an earlier node; preserves history |
86| `applies_to` | Scope of a principle or decision |
87| `enforced_by` | Link from a principle to a check or attestation type |
88| `closes` | A commit/attestation that resolves a bug or task |
89| `references` | Inbound citation from anywhere |
90
91## Schemas (CUE, per type)
92
93Each node type has a CUE schema in `.the-valley/schemas/`. Schemas declare required and optional fields, enum values for status, allowed edge types, etc.
94
95Schemas are themselves versioned with the project. The integrator validates any change introducing or updating a node against its type's schema and rejects malformed ones — schema drift can't happen silently.
96
97Agents producing nodes are handed the schema in their prompt context. Producing valid frontmatter becomes a structured task, not freeform writing.
98
99## Navigation
100
101### Humans
102
103- **File browsing.** `ls .the-valley/bugs/` shows all bugs. `grep -r foo .the-valley/` for full-text. Standard tools, no install.
104- **Editor rendering.** Any markdown editor renders bodies; many resolve `[[]]` references natively.
105- **TUI.** A `valley browse <id>` command renders a node with its inbound/outbound edges, navigable by ID.
106- **Web view.** A static site generated periodically from the graph; clickable, no live server required.
107
108### Agents
109
110- **Direct read.** `cat .the-valley/bugs/bd-a3f2.md` and parse frontmatter. Trivial for any LLM.
111- **Index query.** A small indexer reads all nodes into a queryable store (SQLite at smallest scale; in-memory is fine). Exposes traversal queries: "open bugs blocked on prn-002, sorted by severity." The index is a *projection* — rebuildable from source, nothing depends on its correctness.
112- **Bus subscription.** Node mutations emit events (`node-created`, `node-updated`, `node-status-changed`, `node-linked`). Agents subscribe for reactive behavior — flag drift, file follow-up bugs, dispatch work.
113
114## Composition with the rest of the architecture
115
116- **Identity.** Same SSH keys as commits. A node's `created_by` is a key fingerprint; updates are git commits, natively signed.
117- **Attestation.** A code commit's attestation can include `closes: [bd-a3f2]`; the integrator's success event emits a `node-status-changed` for the bug.
118- **Threads.** Discussion of any node is a thread (`thr-*`); threads are themselves nodes, can scope to any other node or set of nodes. Replaces what GitHub calls "comments."
119- **Generated `AGENTS.md` / `CLAUDE.md`.** Rendered as a projection — render all `status: active` principles as a markdown file at the repo root for any agent walking in cold. Generated, not authored.
120- **Integration policy.** Active principles with `enforced_by` can require the integrator to refuse changes that don't carry the named attestation. Knowledge becomes load-bearing on integration.
121
122## Anti-rot mechanisms
123
124Mostly for later, but worth naming so the design can grow into them:
125
126- **Decay.** Last-touched timestamps + a controller that fires `node-stale` events past a threshold. Surfaces notes for review before they silently die.
127- **Supersession is explicit.** Decisions and principles use `superseded_by` rather than silent rewrite; the old node remains as history.
128- **Backlink hygiene.** Updating a node enqueues its backlinks as "needs-revisit" candidates. Agents or humans triage.
129- **Read tracking.** Agent lookups and human view-opens are logged; surfaces what is actually being consulted. Unread knowledge is dead knowledge.
130- **Agent-flagged drift.** Subscribers can emit drift signals: "new code in repo X violates principle prn-002." The graph's value is reinforced precisely because agents *use* it for their work, and that use produces feedback when stated knowledge and reality diverge.
131
132## What this is not
133
134- **Not a wiki.** Wikis are unstructured prose; this is a typed graph.
135- **Not Obsidian/org-mode.** Those are personal knowledge tools that happen to use plain text. This is a project substrate that exposes a knowledge-tool-shaped surface. Multi-party, signed, composed with the rest of the architecture, agent-first.
136- **Not Jira.** No workflow state machines, no swimlanes, no estimation. Minimum metadata, maximum composability.
137
138## Out of scope for v1
139
140- Cross-repo nodes.
141- Rich attachments (images, binaries). Body-only markdown; attachments later via content-addressed blobs.
142- Migration from existing trackers.
143
144## Open questions
145
146See [openquestions.md](./openquestions.md) — items raised here live under *Knowledge graph specifics*, *Cross-repo coordination*, and *Storage, retention, and evolution*.