feat(memory): templates born v2 (format: 2, no Index); session banner names a v1 registry
This commit is contained in:
1 parent
f6d29bae93
commit
6c9bb7c58b
7 files changed
+58
-55
No files matched your search
+1
-1
@@ -123,7 +123,7 @@ ls ${PROJECT_ROOT}/.claude/tasks/TODO.md ${PROJECT_ROOT}/.claude/memory/ 2>/dev/
|
|||||||
# TODO
|
# TODO
|
||||||
<!-- Claude writes tasks here before implementing. Format: - [ ] task -->
|
<!-- Claude writes tasks here before implementing. Format: - [ ] task -->
|
||||||
```
|
```
|
||||||
- **.claude/memory/ missing** → `mkdir -p ${PROJECT_ROOT}/.claude/memory`, then for each of the 5 registries (`decisions.md`, `learnings.md`, `blockers.md`, `journal.md`, `evals.md`): if the file does not exist in `${PROJECT_ROOT}/.claude/memory/`, copy from `~/.claude/templates/memory/<name>.md` (YAML schema + empty index + inline template comment). If a registry file already exists → skip (do NOT overwrite).
|
- **.claude/memory/ missing** → `mkdir -p ${PROJECT_ROOT}/.claude/memory`, then for each of the 5 registries (`decisions.md`, `learnings.md`, `blockers.md`, `journal.md`, `evals.md`): if the file does not exist in `${PROJECT_ROOT}/.claude/memory/`, copy from `~/.claude/templates/memory/<name>.md` (YAML schema with `format: 2` + inline template comment; no Index, entries go through `lib/memory.sh`). If a registry file already exists → skip (do NOT overwrite).
|
||||||
- **.claude/audits/ missing** → `mkdir -p ${PROJECT_ROOT}/.claude/audits` (empty — populated later by `/onboard` audit phase).
|
- **.claude/audits/ missing** → `mkdir -p ${PROJECT_ROOT}/.claude/audits` (empty — populated later by `/onboard` audit phase).
|
||||||
|
|
||||||
**Do NOT overwrite existing content.**
|
**Do NOT overwrite existing content.**
|
||||||
|
|||||||
@@ -266,6 +266,19 @@ if [ -n "$REPO_DIR" ] && [ -f "$REPO_DIR/CLAUDE.global.md" ]; then
|
|||||||
fi
|
fi
|
||||||
unset _claude_lines
|
unset _claude_lines
|
||||||
fi
|
fi
|
||||||
|
# Registry v1 (BDR-125 phase 4a): a project registry without `format: 2`.
|
||||||
|
# The lib names each v1 registry on stderr (`memory: v1: <file>`).
|
||||||
|
_mem_lib="$(dirname "${BASH_SOURCE[0]}")/../lib/memory.sh"
|
||||||
|
if [ -f "$_mem_lib" ] && [ -d .claude/memory ]; then
|
||||||
|
_v1=$(bash "$_mem_lib" check .claude/memory 2>&1 >/dev/null \
|
||||||
|
| grep -c '^memory: v1:' || true)
|
||||||
|
if [ "${_v1:-0}" -gt 0 ]; then
|
||||||
|
printf "│ ⚠️ %-44s│\n" "registry v1: ${_v1} file(s) (memory.sh check)"
|
||||||
|
fi
|
||||||
|
unset _v1
|
||||||
|
fi
|
||||||
|
unset _mem_lib
|
||||||
|
|
||||||
# Version check: compare local vs remote (non-blocking)
|
# Version check: compare local vs remote (non-blocking)
|
||||||
_remote_ver=""
|
_remote_ver=""
|
||||||
if [ -n "$REPO_DIR" ] && [ -d "$REPO_DIR/.git" ] && [ -z "${SESSION_START_OFFLINE:-}" ]; then
|
if [ -n "$REPO_DIR" ] && [ -d "$REPO_DIR/.git" ] && [ -z "${SESSION_START_OFFLINE:-}" ]; then
|
||||||
|
|||||||
@@ -381,5 +381,17 @@ check T14o-no-restore-noise "$(tr -d ' ' < rs)" 0
|
|||||||
# T12 this repo's registries pass the check
|
# T12 this repo's registries pass the check
|
||||||
check T12-live-check "$(bash "$MEM" -C "$ROOT" check >/dev/null 2>&1; echo $?)" 0
|
check T12-live-check "$(bash "$MEM" -C "$ROOT" check >/dev/null 2>&1; echo $?)" 0
|
||||||
|
|
||||||
|
# T13 templates are born v2; the session banner names a v1 project only
|
||||||
|
for t in decisions learnings blockers evals; do
|
||||||
|
check "T13-template-$t-v2" "$(sed -n 2p "$ROOT/templates/memory/$t.md")" 'format: 2'
|
||||||
|
check "T13b-template-$t-no-index" "$(grep -c '^## Index$' "$ROOT/templates/memory/$t.md")" 0
|
||||||
|
done
|
||||||
|
banner() { (cd "$1" && SESSION_START_OFFLINE=1 bash "$ROOT/hooks/session-start.sh" \
|
||||||
|
</dev/null 2>/dev/null) | grep -c "${2:-registry v1}"; }
|
||||||
|
check T13c-banner-v1-v2 "$(banner "$FIX/v1h" 'registry v1: 1 file(s) (memory.sh check)')/$(banner "$FIX")" 1/0
|
||||||
|
cp "$FIX/v1h/.claude/memory/blockers.md" v1h.bak
|
||||||
|
printf -- '---\nformat: 2\n---\n' > "$FIX/v1h/.claude/memory/blockers.md"
|
||||||
|
check T13d-banner-flips-off "$(banner "$FIX/v1h")" 0
|
||||||
|
cat v1h.bak > "$FIX/v1h/.claude/memory/blockers.md"
|
||||||
echo "PASS=$pass FAIL=$fail"
|
echo "PASS=$pass FAIL=$fail"
|
||||||
[ "$fail" -eq 0 ]
|
[ "$fail" -eq 0 ]
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
format: 2
|
||||||
type: blockers_registry
|
type: blockers_registry
|
||||||
entry_prefix: BLK
|
entry_prefix: BLK
|
||||||
schema:
|
schema:
|
||||||
@@ -17,19 +18,13 @@ rules:
|
|||||||
|
|
||||||
# Blockers registry (BLK)
|
# Blockers registry (BLK)
|
||||||
|
|
||||||
## Index
|
<!-- Written only by `bash ~/.claude/lib/memory.sh add blocker --title "<friction>"
|
||||||
|
--body-file <file> [--status open]` (it allocates the ID). Entry shape:
|
||||||
|
|
||||||
| ID | Date | Friction | Status |
|
## BLK-NNN — <friction> [open] (YYYY-MM-DD)
|
||||||
|----|------|---------|--------|
|
- **Friction**: <what was blocked>
|
||||||
|
- **Real cause**: <root cause>
|
||||||
<!-- Append entries below. Template:
|
- **Solution**: <workaround or fix>
|
||||||
|
|
||||||
## BLK-XXX - <friction>
|
|
||||||
|
|
||||||
- **Date**: YYYY-MM-DD
|
|
||||||
- **Friction**: <what was blocked>
|
|
||||||
- **Real cause**: <root cause>
|
|
||||||
- **Solution**: <workaround or fix>
|
|
||||||
- **Status**: open | resolved | upstream
|
|
||||||
|
|
||||||
|
Later status: `bash ~/.claude/lib/memory.sh status BLK-NNN "resolved <hash>"`.
|
||||||
-->
|
-->
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
format: 2
|
||||||
type: decisions_registry
|
type: decisions_registry
|
||||||
entry_prefix: BDR
|
entry_prefix: BDR
|
||||||
schema:
|
schema:
|
||||||
@@ -19,22 +20,14 @@ rules:
|
|||||||
|
|
||||||
# Decisions registry (BDR)
|
# Decisions registry (BDR)
|
||||||
|
|
||||||
## Index
|
<!-- Written only by `bash ~/.claude/lib/memory.sh add decision --title "<title>"
|
||||||
|
--body-file <file> [--status accepted]` (it allocates the ID). Entry shape:
|
||||||
|
|
||||||
| ID | Date | Title | Status |
|
## BDR-NNN — <title> [accepted] (YYYY-MM-DD)
|
||||||
|----|------|-------|--------|
|
- **Decision**: <what was chosen>
|
||||||
|
- **Why**: <motivation>
|
||||||
<!-- Append entries below. Template:
|
- **Rejected alternatives**: <each option, why rejected>
|
||||||
|
- **Reference**: <commit / PR / file>
|
||||||
## BDR-XXX - <title>
|
|
||||||
|
|
||||||
- **Date**: YYYY-MM-DD
|
|
||||||
- **Status**: proposed | accepted | deprecated | superseded
|
|
||||||
- **Decision**: <what was chosen>
|
|
||||||
- **Why**: <motivation>
|
|
||||||
- **Rejected alternatives**:
|
|
||||||
- Option A - <why rejected>
|
|
||||||
- Option B - <why rejected>
|
|
||||||
- **Reference**: <commit / PR / file>
|
|
||||||
|
|
||||||
|
Later status: `bash ~/.claude/lib/memory.sh status BDR-NNN "superseded by BDR-NNN"`.
|
||||||
-->
|
-->
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
format: 2
|
||||||
type: evals_registry
|
type: evals_registry
|
||||||
entry_prefix: EVAL
|
entry_prefix: EVAL
|
||||||
schema:
|
schema:
|
||||||
@@ -18,19 +19,13 @@ rules:
|
|||||||
|
|
||||||
# Evals registry (EVAL)
|
# Evals registry (EVAL)
|
||||||
|
|
||||||
## Index
|
<!-- Written only by `bash ~/.claude/lib/memory.sh add eval --title "<output>"
|
||||||
|
--body-file <file> [--status keep]` (it allocates the ID). Entry shape:
|
||||||
|
|
||||||
| ID | Date | Output | Action |
|
## EVAL-NNN — <output> [keep] (YYYY-MM-DD)
|
||||||
|----|------|--------|--------|
|
- **Output**: <what was produced>
|
||||||
|
- **Method**: <how it was evaluated>
|
||||||
<!-- Append entries below. Template:
|
- **Anomalies**: <what is wrong, missing, surprising>
|
||||||
|
- **Action**: <keep | correct | deprecate>
|
||||||
## EVAL-XXX - <output>
|
|
||||||
|
|
||||||
- **Date**: YYYY-MM-DD
|
|
||||||
- **Output**: <what was produced>
|
|
||||||
- **Method**: <how it was evaluated>
|
|
||||||
- **Anomalies**: <what is wrong, missing, surprising>
|
|
||||||
- **Action**: keep | correct | deprecate
|
|
||||||
|
|
||||||
-->
|
-->
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
format: 2
|
||||||
type: learnings_registry
|
type: learnings_registry
|
||||||
entry_prefix: LRN
|
entry_prefix: LRN
|
||||||
schema:
|
schema:
|
||||||
@@ -16,18 +17,12 @@ rules:
|
|||||||
|
|
||||||
# Learnings registry (LRN)
|
# Learnings registry (LRN)
|
||||||
|
|
||||||
## Index
|
<!-- Written only by `bash ~/.claude/lib/memory.sh add learning
|
||||||
|
--title "<abstract pattern>" --body-file <file>` (it allocates the ID). Entry shape:
|
||||||
|
|
||||||
| ID | Date | Pattern | Applies to |
|
## LRN-NNN — <abstract pattern> (YYYY-MM-DD)
|
||||||
|----|------|---------|------------|
|
- **Pattern**: <what was observed, phrased for reuse>
|
||||||
|
- **Context**: <where and when, concrete>
|
||||||
<!-- Append entries below. Template:
|
- **Future application**: <when to recall this>
|
||||||
|
|
||||||
## LRN-XXX - <abstract pattern>
|
|
||||||
|
|
||||||
- **Date**: YYYY-MM-DD
|
|
||||||
- **Pattern**: <what was observed, phrased for reuse>
|
|
||||||
- **Context**: <where and when, concrete>
|
|
||||||
- **Future application**: <when to recall this>
|
|
||||||
|
|
||||||
-->
|
-->
|
||||||
Reference in new issue
Block a user