| 1 | # .the-valley — knowledge v0 |
| 2 | |
| 3 | The knowledge-graph convention from |
| 4 | [user-scenarios.md § S1](../design/user-scenarios.md#s1--my-repos-live-on-my-infrastructure-and-i-can-never-lose-them): |
| 5 | **a directory convention, not a system**. Issues, outcomes, ideas, and decisions live with the repo |
| 6 | as plain files, cloned and backed up by the same motion that protects the code. |
| 7 | |
| 8 | ## The convention |
| 9 | |
| 10 | One file per node. Each file is markdown with YAML frontmatter carrying the structured layer: |
| 11 | |
| 12 | ```yaml |
| 13 | --- |
| 14 | type: idea # outcome | bug | idea | decision |
| 15 | id: ida-eac723e # <prefix>-<short hash> |
| 16 | status: adopted # see enums below |
| 17 | title: One-line human title |
| 18 | created: 2026-07-02 |
| 19 | source: PR #1 # optional — where the content came from |
| 20 | --- |
| 21 | ``` |
| 22 | |
| 23 | Two typed edges exist, each a list of node ids in frontmatter. |
| 24 | |
| 25 | **Outcome nodes carry `blocked_by`**: the nodes an outcome waits on. The live outcome-DAG experiment |
| 26 | ([ideas/ida-3145b7a-demand-pressure.md](./ideas/ida-3145b7a-demand-pressure.md)) requires it. A |
| 27 | blocker clears when its own status is terminal for its type: an idea at `graduated`, `superseded` or |
| 28 | `discarded`; a decision at `decided` or `superseded`; a bug at `closed`; an outcome at `done` or |
| 29 | `abandoned` ([[dcr-593d3d1]] |
| 30 | ([decisions/dcr-593d3d1-ideas-are-transitional.md](./decisions/dcr-593d3d1-ideas-are-transitional.md))). |
| 31 | |
| 32 | **Idea and decision nodes carry `supersedes`**: the nodes this one replaces. Ideas and decisions are |
| 33 | the only types that carry it, because they are the only two whose status enum has a `superseded` |
| 34 | value for the replaced node to land in. The lint requires that status to be set, so a supersession |
| 35 | cannot be half-declared. Declaring it is the machine-readable half of the resolution rule below; the |
| 36 | prose still has to be corrected too. |
| 37 | |
| 38 | **Graduated ideas carry `graduated_into`**: the decision node id, or the repo-root-relative path of |
| 39 | the design document, the idea's thinking moved to. An idea is transitional ([[dcr-593d3d1]] |
| 40 | ([decisions/dcr-593d3d1-ideas-are-transitional.md](./decisions/dcr-593d3d1-ideas-are-transitional.md))): |
| 41 | it graduates, is superseded, or is discarded, and `adopted` marks an idea accepted and awaiting |
| 42 | graduation. The field is required exactly when the status is `graduated`, so a graduation cannot be |
| 43 | half-declared. |
| 44 | |
| 45 | The remaining typed edges (`closes`, …) come later; until then, prose links in the body are enough. |
| 46 | |
| 47 | ## Types, directories, prefixes |
| 48 | |
| 49 | | Type | Directory | Prefix | Status enum | |
| 50 | | -------- | ------------ | ------- | ------------------------------------------------------------------------------- | |
| 51 | | outcome | `outcomes/` | `oc-*` | `open` \| `in-progress` \| `done` \| `abandoned` | |
| 52 | | bug | `bugs/` | `bd-*` | `open` \| `closed` | |
| 53 | | idea | `ideas/` | `ida-*` | `raw` \| `exploring` \| `adopted` \| `graduated` \| `superseded` \| `discarded` | |
| 54 | | decision | `decisions/` | `dcr-*` | `proposed` \| `decided` \| `superseded` | |
| 55 | |
| 56 | An id is its type's prefix plus the first 7 hex characters of the SHA-256 of the slug — |
| 57 | coordination-free, at the cost of prettiness. Filenames are `<id>-<slug>.md`. The hash for a slug: |
| 58 | |
| 59 | ```sh |
| 60 | printf '%s' '<slug>' | sha256sum | cut -c1-7 |
| 61 | ``` |
| 62 | |
| 63 | The lint checks the derivation for every node created after 2026-08-05; earlier nodes keep the ids |
| 64 | they have, checked for shape and uniqueness only. |
| 65 | |
| 66 | The same table in checkable form is [`schema/node.cue`](../../schema/node.cue), which the knowledge |
| 67 | lint vets every node's frontmatter against. |
| 68 | |
| 69 | ## Writing a node |
| 70 | |
| 71 | **The graph at any commit presents the design as it stands now.** It carries no history of how the |
| 72 | thinking got there. That history is in git history, and only there. |
| 73 | |
| 74 | - **Restate, don't accrete.** When thinking evolves, rewrite the node as the cleanest statement of |
| 75 | current understanding. No Addendum, Update, Revision or Correction sections, ever, and no |
| 76 | superseded framing left standing beside its replacement. |
| 77 | - **A node never defines the design by contrast with an earlier or rejected version of itself.** No |
| 78 | "not one", no "rather than", no "as described above, but actually". A decision node records what |
| 79 | was decided, not the options weighed against it. |
| 80 | - **Rationale stays; deliberation goes.** This is the distinction that makes the rule above usable. |
| 81 | A reason stated as a property of the current design belongs in the node; a record of a fork being |
| 82 | weighed and settled does not. When unsure, state the reason positively as a fact about the design |
| 83 | rather than as a comparison against something not chosen. |
| 84 | - **A node must not assert something and then correct itself later in the same document.** State it |
| 85 | correctly where a reader meets it first. A reader who stops halfway must not be left with the |
| 86 | superseded version. |
| 87 | - **Replacing something includes deleting what it replaces, in the same change.** This covers the |
| 88 | files a node points at as much as its prose — a superseded example left beside its replacement is |
| 89 | the same defect as a superseded paragraph. |
| 90 | - **Where two documents make incompatible claims, the more recently written claim is the current |
| 91 | one.** `git blame` the lines carrying each claim rather than the files: a formatting sweep or an |
| 92 | edit elsewhere touches a file without changing what it asserts. Correcting the stale claim belongs |
| 93 | to the change that found the contradiction, not to a later one — that is the rule above, applied |
| 94 | across two documents instead of within one. The rule's limit, stated plainly: recency establishes |
| 95 | which claim was written later, never which one is right. Where the newer claim is the mistake, the |
| 96 | resolution is still a change that leaves the corpus saying one thing, and never an annotation |
| 97 | explaining the discrepancy. |
| 98 | |
| 99 | Two rules that govern the design documents govern nodes identically, and are stated once, where they |
| 100 | already live: |
| 101 | |
| 102 | - **Disembodied voice** — [AGENTS.md](../../AGENTS.md), writing standard. A node speaks about |
| 103 | the-valley itself: no names, no second person, no reference to project participants. Roles are |
| 104 | fine, as are external prior art and its authors. Frontmatter `source:` follows the same rule; it |
| 105 | names a date and a venue, never a person. |
| 106 | - **Prose format** — [[ida-1ec03b1]] |
| 107 | ([ideas/ida-1ec03b1-path-scoped-verification-policy.md](./ideas/ida-1ec03b1-path-scoped-verification-policy.md)). |
| 108 | Markdown prose is filled paragraphs hard-wrapped at 100 characters. `nix run .#fmt` rewraps; the |
| 109 | flake's `prose-format` check enforces it. |
| 110 | |
| 111 | ## The interface |
| 112 | |
| 113 | - **Creating a node is a commit.** Closing one is a commit that flips `status`. |
| 114 | - **Listing is `ls`. Search is `grep`. History is `git log`.** |
| 115 | - No indexer and no events. |
| 116 | - **The convention is checked, not enforced.** `nix flake check` runs `knowledge-lint`: every node's |
| 117 | frontmatter vetted against [`schema/node.cue`](../../schema/node.cue), every filename agreeing |
| 118 | with the frontmatter it carries, and every `[[wiki-link]]`, `blocked_by` id, `supersedes` id, |
| 119 | `graduated_into` target and relative link resolving. A `supersedes` id must further name a node |
| 120 | whose own status is `superseded`. It reports; nothing stops a broken graph from landing until |
| 121 | there is an integrator to stop it. |
| 122 | |
| 123 | The lint is not this repo's alone. The flake exposes it as `lib.knowledgeLint`, so any project that |
| 124 | keeps a graph gets the same check by taking the-valley as a flake input and instantiating it over |
| 125 | its own tree — see the comment on that output in [flake.nix](../../flake.nix) for the whole of a |
| 126 | consuming flake, and [[ida-a9e274c]] |
| 127 | ([ideas/ida-a9e274c-mandated-checks-come-from-the-instance.md](./ideas/ida-a9e274c-mandated-checks-come-from-the-instance.md)) |
| 128 | for why the derivation travels rather than the convention. |