forked from bchanot/claude
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
|
||||
<!-- 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).
|
||||
|
||||
**Do NOT overwrite existing content.**
|
||||
|
||||
@@ -266,6 +266,19 @@ if [ -n "$REPO_DIR" ] && [ -f "$REPO_DIR/CLAUDE.global.md" ]; then
|
||||
fi
|
||||
unset _claude_lines
|
||||
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)
|
||||
_remote_ver=""
|
||||
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
|
||||
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"
|
||||
[ "$fail" -eq 0 ]
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
format: 2
|
||||
type: blockers_registry
|
||||
entry_prefix: BLK
|
||||
schema:
|
||||
@@ -17,19 +18,13 @@ rules:
|
||||
|
||||
# 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 |
|
||||
|----|------|---------|--------|
|
||||
|
||||
<!-- Append entries below. Template:
|
||||
|
||||
## BLK-XXX - <friction>
|
||||
|
||||
- **Date**: YYYY-MM-DD
|
||||
- **Friction**: <what was blocked>
|
||||
- **Real cause**: <root cause>
|
||||
- **Solution**: <workaround or fix>
|
||||
- **Status**: open | resolved | upstream
|
||||
## BLK-NNN — <friction> [open] (YYYY-MM-DD)
|
||||
- **Friction**: <what was blocked>
|
||||
- **Real cause**: <root cause>
|
||||
- **Solution**: <workaround or fix>
|
||||
|
||||
Later status: `bash ~/.claude/lib/memory.sh status BLK-NNN "resolved <hash>"`.
|
||||
-->
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
format: 2
|
||||
type: decisions_registry
|
||||
entry_prefix: BDR
|
||||
schema:
|
||||
@@ -19,22 +20,14 @@ rules:
|
||||
|
||||
# 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 |
|
||||
|----|------|-------|--------|
|
||||
|
||||
<!-- Append entries below. Template:
|
||||
|
||||
## 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>
|
||||
## BDR-NNN — <title> [accepted] (YYYY-MM-DD)
|
||||
- **Decision**: <what was chosen>
|
||||
- **Why**: <motivation>
|
||||
- **Rejected alternatives**: <each option, 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
|
||||
entry_prefix: EVAL
|
||||
schema:
|
||||
@@ -18,19 +19,13 @@ rules:
|
||||
|
||||
# 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 |
|
||||
|----|------|--------|--------|
|
||||
|
||||
<!-- Append entries below. Template:
|
||||
|
||||
## 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
|
||||
## EVAL-NNN — <output> [keep] (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
|
||||
entry_prefix: LRN
|
||||
schema:
|
||||
@@ -16,18 +17,12 @@ rules:
|
||||
|
||||
# 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 |
|
||||
|----|------|---------|------------|
|
||||
|
||||
<!-- Append entries below. Template:
|
||||
|
||||
## 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>
|
||||
## LRN-NNN — <abstract pattern> (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