Skip to content

Commit 8359677

Browse files
acn-ericlawclaude
andcommitted
chore(agent-memory): upgrade 4.38.1 -> 4.39.0 — merge-scale thread layout
Reconcile + the two 4.39.0 semantic steps: 10 Open Threads moved verbatim from continuity.md to memory/open-threads/thread-<id>.md, last_session dropped (derived from the newest session log), archive files union-merge, protocol re-copied (was stock). memory-lint 0 errors; refresh-metadata cleared the pre-existing stale tiers (the review itself remains due). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 526c16b commit 8359677

34 files changed

Lines changed: 1230 additions & 229 deletions

‎.agent/schema.md‎

Lines changed: 67 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ Live project state. Update every session.
5252
- project: string
5353
- status: string
5454
- last_enabled: YYYY-MM-DD
55-
- last_session: YYYY-MM-DD | agent: string (or "none yet" — legacy: pre-4.32.1 enables only; a fresh enable points this at its first enable session log)
5655
- last_review: YYYY-MM-DD | through <session-file> (or "none yet")
5756
- last_invariant_check: YYYY-MM-DD | through <session-file> (or "none yet") — see REVIEW.md step 6
5857
- last_harvest: YYYY-MM-DD | through <session-file> (optional; omit until first run) — when the `harvest-knowledge` skill last folded docs into memory; it reads this to scope the next harvest and stamps it on completion
@@ -62,11 +61,17 @@ Live project state. Update every session.
6261
## Stack & Tools canonical live home for language/deps/tool versions (key: value)
6362
## Key Decisions bullet list, present tense
6463
## Conventions bullet list
65-
## Open Threads - [ ] incomplete / - [x] complete (leave [x] for the review to sweep)
64+
## Open Threads pointer note only — threads live one-per-file in memory/open-threads/ (v4.39.0)
6665
## User Preferences bullet list — record ONLY what the user explicitly states; never infer
6766
## Team / Members name: preferred agent
6867
```
6968

69+
There is deliberately **no `last_session` field** (dropped in v4.39.0): it is fully
70+
derivable — the newest `memory/sessions/` filename is the last session, and that log's
71+
`**Agent:**` header names the agent — and as a scalar that changed every session it was
72+
the most frequent merge conflict in the file. A pre-4.39.0 repo may still carry the
73+
line; treat it as legacy-informational (latest wins on conflict; safe to delete).
74+
7075
`## Stack & Tools` is the single canonical home for the current stack — language
7176
version, dependencies, tool versions. `instructions.md` gives only an enduring
7277
high-level descriptor and points here; don't maintain the dep list in both.
@@ -82,23 +87,25 @@ lives in the project's own `CHANGELOG`/release notes and the **session logs** (e
8287
### Concurrency & merge-friendliness (continuity.md is a shared file)
8388

8489
`continuity.md` is committed and edited by every teammate, on any vendor — so author it to
85-
**merge cleanly**. Session logs avoid conflicts by construction (timestamped filenames);
86-
`continuity.md` cannot, so follow these conventions:
90+
**merge cleanly**. Session logs and Open Thread files avoid conflicts by construction
91+
(one file per event / per thread); the rest of `continuity.md` cannot, so follow these
92+
conventions:
8793

8894
- **One fact per line.** No monster lines. A short line that two people change is a trivial
8995
conflict; a 20 KB line is an unresolvable one.
90-
- **Append-only sections are independent facts.** `## Open Threads`, `## Key Decisions`,
91-
`## Conventions` accrete bullets that don't depend on each other.
96+
- **Append-only sections are independent facts.** `## Key Decisions` and `## Conventions`
97+
accrete bullets that don't depend on each other. (Open Threads no longer accrete here —
98+
each is its own file under `memory/open-threads/`, so concurrent thread work can't
99+
conflict at all.)
92100
- **Conflict resolution = keep both, by default.** When two branches both added to an
93101
append-only section, the merge is a **union** — keep every side's bullets (they're
94102
independent facts); never drop one to "resolve" faster.
95-
- **Scalar bumps take the later value.** `last_session` / `last_review` /
96-
`last_invariant_check` / the `status` version token: on conflict, keep the **later date /
97-
higher version**. (`.agent/version.md` is the canonical version; `status`'s token is just a
98-
human cue.) `last_session` is also derivable from the newest `sessions/` filename, so it's
99-
informational — never block on it.
103+
- **Scalar bumps take the later value.** `last_review` / `last_invariant_check` / the
104+
`status` version token: on conflict, keep the **later date / higher version**.
105+
(`.agent/version.md` is the canonical version; `status`'s token is just a human cue.)
100106
- **Same-thread edits need a human.** Only a genuine semantic clash — both sides editing the
101-
*same* Open Thread, or a `[ ]`→`[x]` race — warrants judgment; everything else is mechanical.
107+
*same* Open Thread file, or a `[ ]`→`[x]` race — warrants judgment; everything else is
108+
mechanical. Thread files make that clash visible as a per-file conflict.
102109
- A left-behind conflict marker (`<<<<<<<`, `=======`, `>>>>>>>`) corrupts memory; `memory-lint`
103110
flags it as an ERROR.
104111

@@ -128,11 +135,11 @@ ordinary fact, `core` for an Architectural Invariant — and seeds `last_used: <
128135
recomputed by the review from session-log `## Memory References` (see `DECAY.md` §1).
129136

130137
`## Architectural Invariants` facts and unchecked Open Threads (`- [ ]`) never decay.
131-
Completed threads (`- [x]`) stay in place until the review sweeps them (see below /
132-
`REVIEW.md`) — don't archive them by hand. A completed thread's record is a **3–6-line
133-
close stub** — outcome, PR/commit/release refs, one durable lesson, `origin:` pointer —
134-
never a full ship narrative: that belongs in the origin session log, and reviews condense
135-
oversized records (`[closed-thread-bloat]`, v4.38.0).
138+
Completed threads (`- [x]`) stay in their thread file until the review sweeps them (see
139+
`memory/open-threads/` below / `REVIEW.md`) — don't archive them by hand. A completed
140+
thread's record is a **3–6-line close stub** — outcome, PR/commit/release refs, one durable
141+
lesson, `origin:` pointer — never a full ship narrative: that belongs in the origin session
142+
log, and reviews condense oversized records (`[closed-thread-bloat]`, v4.38.0).
136143

137144
When a fact becomes **false** (a decision reversed, a dependency dropped), don't just
138145
delete it: set its footer to `tier: superseded` + `superseded-by: <new-id>` (omit the
@@ -141,6 +148,39 @@ and let the review archive it flagged "superseded." See `DECAY.md` §9.
141148

142149
---
143150

151+
## memory/open-threads/thread-<id>.md
152+
153+
**One Open Thread per file** (v4.39.0). `<id>` is the thread's kebab fact id — the
154+
filename is the identity and **never changes** for the thread's lifetime; updates edit the
155+
file in place. This is what makes concurrent thread work merge-free: parallel branches
156+
touching *different* threads touch different files (no conflict possible), and both sides
157+
editing the *same* thread conflict per-file — a genuine Tier 2 semantic clash correctly
158+
reaching a human (`MERGE.md`).
159+
160+
File content is **exactly the thread's bullet block**, nothing else — the same shape that
161+
previously sat under continuity's `## Open Threads`:
162+
163+
```
164+
- [ ] **<title>.** <body — what the thread is, why it's open, next action>
165+
→ serves: <vision-id or blueprint-id> (VBDI trace, where applicable)
166+
<!-- id: <same-as-filename> | created: YYYY-MM-DD | last_used: YYYY-MM-DD | uses: N | tier: working -->
167+
```
168+
169+
- **No index file.** The directory is the index, like `sessions/`: list
170+
`memory/open-threads/` to discover threads; the checkbox in each file is its state
171+
(`grep -l '^- \[ \]' memory/open-threads/` lists the open ones). An index would
172+
recreate the add/add merge conflict one line at a time.
173+
- **Lifecycle is unchanged, only the location moved.** An unchecked thread is pinned
174+
(never decays); a completed one flips to `- [x]`, condenses to a 3–6-line stub, and
175+
waits out `archive_window`; the review sweep moves the block to the quarter archive +
176+
`INDEX.md` and deletes the file (`archive-fact` handles thread files). Contradiction /
177+
Drift / new threads are created as new files.
178+
- `memory-lint` pins the contract: `[thread-file]` (filename must match the footer id;
179+
exactly one thread block per file) and `[duplicate-id]` (an id must exist once across
180+
continuity + thread files — the backstop for creation collisions on parallel branches).
181+
182+
---
183+
144184
## memory/sessions/YYYY-MM-DD-HHMMSS.md
145185

146186
**A "session" is one write of a session-log file** — the unit of work since the last
@@ -240,8 +280,8 @@ invariant-verification cadence (a vision can go stale). Created at enable/upgrad
240280
⚠️ DRAFT stub — Current-state context inferred, target left for the human — **never
241281
fabricated**. See `DECAY.md` §12 and `docs/DESIGN-vbdi-lifecycle.md`.
242282

243-
The **Blueprint** (the Vision↔Current-State gap) is *not* a separate file — it is a set
244-
of typed Open Threads in `continuity.md`:
283+
The **Blueprint** (the Vision↔Current-State gap) is *not* a separate file — it is the set
284+
of typed Open Threads (one file each under `memory/open-threads/`):
245285
`- [ ] (blueprint) <gap> → serves: <vision-id>`. Designs (Key Decisions) and
246286
Implementations (commits/sessions) trace up the altitude chain by `id`; a missing or
247287
broken link is drift, and it's grep-detectable.
@@ -295,10 +335,17 @@ deleted; reactivation moves a fact back into `continuity.md` (see `REVIEW.md`).
295335

296336
```
297337
archive/
298-
YYYY-QN.md facts (with their metadata footers) moved out of continuity.md, grouped by quarter
338+
YYYY-QN.md facts (with their metadata footers) moved out of the live layer, grouped by quarter
299339
INDEX.md one line per archived fact: `id — one-line summary — <quarter file>` (greppable)
300340
```
301341

342+
Archive files are append-mostly, so `.gitattributes` marks them `merge=union`
343+
(v4.39.0): concurrent review sweeps appending at end-of-file merge without conflict.
344+
The one case union gets wrong — a reactivation's removed lines resurrected by the other
345+
branch — is deterministically caught by `memory-lint`'s `[both]` / `[over-archived]`
346+
ERRORs. Live files (`continuity.md`, thread files) never get union: there a conflict is
347+
signal.
348+
302349
---
303350

304351
## agent-skills/ (capability layer — cross-vendor)

‎.agent/version.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
> Mode B can detect drift and upgrade in place (see the tool's `UPGRADE.md`).
55
> `version` gates the upgrade ladder — don't hand-edit it unless you mean to.
66
7-
- **version:** 4.38.1
7+
- **version:** 4.39.0
88
- **enabled_with:** 4.38.0
9-
- **last_upgraded:** 2026-08-25
9+
- **last_upgraded:** 2026-09-01
1010
- **mode:** A

‎.gitattributes‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# agent-memory — keep executable scripts + git hooks LF so bash runs them on Windows (Git Bash / WSL).
22
# Git for Windows defaults to core.autocrlf=true; without this, *.sh and .githooks/* would be rewritten
33
# to CRLF on checkout and bash would fail with "bad interpreter: /usr/bin/env bash^M".
4+
memory/archive/*.md merge=union
45
*.sh text eol=lf
56
.githooks/* text eol=lf
67
.githooks/*.d/* text eol=lf

‎DECAY.md‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@
1717

1818
## 1. Fact metadata
1919

20-
Every fact in `memory/continuity.md` carries an HTML-comment footer. Invisible
21-
when rendered, readable and editable by any agent or human, diff-friendly.
20+
Every fact carries an HTML-comment footer. Invisible when rendered, readable and
21+
editable by any agent or human, diff-friendly. Facts live on two surfaces that these
22+
rules treat identically: `memory/continuity.md`, and — for Open Threads — one file per
23+
thread under `memory/open-threads/` (`thread-<id>.md`, filename = the fact id;
24+
v4.39.0, so concurrent thread work merges without conflict — see `.agent/schema.md`).
2225

2326
```markdown
2427
- POST-only for mutations, no PUT/PATCH (legacy decision, do not change)
@@ -27,7 +30,7 @@ when rendered, readable and editable by any agent or human, diff-friendly.
2730

2831
| Field | Set | Recomputed at review? |
2932
|---|---|---|
30-
| `id` | once at creation; kebab-case, unique within the file; never changes | no |
33+
| `id` | once at creation; kebab-case, unique across continuity + thread files; never changes | no |
3134
| `created` | once at creation (date the fact entered memory) | no |
3235
| `last_used` | date of the most recent session that referenced the id | **yes** |
3336
| `uses` | count of sessions that referenced the id | **yes** |
@@ -50,8 +53,10 @@ rows above). `id` and `created` are immutable. Ordinary facts are born `working`
5053

5154
### Assigning an id
5255
Lowercase, hyphenated, derived from the fact's gist (`webhook-fire-forget`,
53-
`drizzle-over-prisma`). Unique within `continuity.md`. Once assigned it is
54-
permanent — it is the handle that session logs use to reference the fact.
56+
`drizzle-over-prisma`). Unique across the live layer — `continuity.md` and every
57+
`memory/open-threads/thread-<id>.md` (`memory-lint` flags a `[duplicate-id]`). Once
58+
assigned it is permanent — it is the handle that session logs use to reference the
59+
fact, and for a thread it is also the filename.
5560

5661
---
5762

@@ -258,9 +263,10 @@ Everything above is *backward*-looking — it keeps memory faithful to what happ
258263
*intended*. Full design: `docs/DESIGN-vbdi-lifecycle.md`. The rule-level essentials the
259264
memory layer enforces:
260265

261-
- **The primitives.** *Current State* = `continuity.md` (read at session start). *Vision* =
262-
`memory/vision.md` (the target; `core`, invariant-verified). *Blueprint* = typed
263-
`(blueprint)` Open Threads = the Vision↔Current-State gap. *Design* = Key Decisions /
266+
- **The primitives.** *Current State* = `continuity.md` + the Open Thread files (read at
267+
session start). *Vision* = `memory/vision.md` (the target; `core`, invariant-verified).
268+
*Blueprint* = typed `(blueprint)` Open Threads (one file each under
269+
`memory/open-threads/`) = the Vision↔Current-State gap. *Design* = Key Decisions /
264270
Architectural Invariants (and, **optionally**, a human-facing `docs/arch-decisions/ADR.md` decision log
265271
— Architecture Decision Records, read on demand, never in the per-session path; its
266272
supersede/deprecate-never-delete lifecycle mirrors §9, and — once the log exists — is **kept in

‎MERGE.md‎

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77
## Why this exists
88

99
`memory/` is committed and shared, so concurrent teammates — on any vendor — will sometimes
10-
collide. Session logs almost never conflict (timestamped filenames); `continuity.md` can.
11-
The hard rule comes straight from the **`never-pick-a-winner`** invariant:
10+
collide. Session logs almost never conflict (timestamped filenames), Open Threads can't
11+
conflict across threads (one file each under `memory/open-threads/`, v4.39.0), and archive
12+
files union-merge (`.gitattributes`); what remains is `continuity.md` and the rare
13+
same-thread-file clash. The hard rule comes straight from the **`never-pick-a-winner`**
14+
invariant:
1215

1316
> **An AI must never silently choose a winner between two conflicting memory facts.**
1417
@@ -33,13 +36,15 @@ isn't "don't touch the text," it's "don't silently pick a winner.")
3336
Look at what actually diverged between the two sides:
3437

3538
- **Additive** — both sides *added* different facts/bullets to an append-only section
36-
(`## Open Threads`, `## Key Decisions`, `## Conventions`, `## What's Been Built`). The
37-
commonest case.
38-
- **Scalar** — both sides bumped the same single-value field (`last_session`, `last_review`,
39+
(`## Key Decisions`, `## Conventions`, `## What's Been Built`). The commonest
40+
continuity case.
41+
- **Scalar** — both sides bumped the same single-value field (`last_review`,
3942
`last_invariant_check`, the `status` version token).
40-
- **Semantic clash** — both sides changed the **same** fact's substance; or one checked a
43+
- **Semantic clash** — both sides changed the **same** fact's substance (in continuity, or
44+
a conflict in the *same* `memory/open-threads/thread-<id>.md` file); or one checked a
4145
thread `[ ]`→`[x]` while the other edited it; or a fact was superseded on one side and
42-
edited on the other. The rare case — and the **only** one needing judgment.
46+
edited on the other. The rare case — and the **only** one needing judgment. A thread-file
47+
conflict is *always* this class — the layout has already eliminated the mechanical cases.
4348

4449
## (2) Resolve by tier
4550

@@ -48,8 +53,14 @@ Look at what actually diverged between the two sides:
4853
- **Additive → UNION. Keep BOTH sides' additions.** They are independent facts; dropping
4954
either loses information. Order doesn't matter — the review re-sorts and decays. Each fact
5055
keeps its own `id` + footer.
51-
- **Scalar → take the LATER value** (later date / higher semver). `last_session` is also
52-
derivable from the newest `sessions/` filename, so never block on it.
56+
- **Scalar → take the LATER value** (later date / higher semver).
57+
- **Archive files** (`memory/archive/*.md`) carry `merge=union` in `.gitattributes`, so
58+
concurrent sweeps' appends merge on their own. The one case union gets wrong — a
59+
reactivation's removed lines resurrected by the other side — is caught by `memory-lint`'s
60+
`[both]` / `[over-archived]` ERRORs; fix by re-removing the resurrected block.
61+
- **Two session logs with the same filename** (same-second persist on parallel branches —
62+
an add/add conflict): keep both by renaming either one +1 second; never merge their
63+
contents into one file.
5364

5465
No "propose a repair" step — apply the rule.
5566

0 commit comments

Comments
 (0)