feat(doctrine): session start reads TODO and the digest, web rules deduped, graphify run from the repo

Session start reads TODO.md and the memory digest, registries on demand.
web-security keeps only its own rules and points to secure-by-default; the
graphify rule names the CLAUDE.global.md append, Step 7 runs from $REPO.
This commit is contained in:
bchanot committed 2026-11-12 12:05:55 +01:00
1 parent 1cc89bee35
commit c69ce9ca88
5 files changed
+32 -26

No files matched your search

+12 -9
View File
@@ -5,23 +5,26 @@ paths: ["skills/graphify/**", "install-plugins.sh"]
# Machine-owned: the vendored graphify skill
`skills/graphify/SKILL.md`, `skills/graphify/references/` and
`.graphify_version` are written by `graphify claude install`
(`install-plugins.sh` STEP graphify), which lands in the repo because
`~/.claude/skills` is a symlink to `skills/`. They are gitignored: a
`.graphify_version` are written by `graphify install` (default platform
claude; `install-plugins.sh` STEP graphify), which lands in the repo
because `~/.claude/skills` is a symlink to `skills/`. They are gitignored: a
`pipx upgrade graphifyy` used to dirty the tree and cost a
`chore(graphify): sync vendored skill X -> Y` commit each time.
Two graphify commands, easy to confuse, and only one restores the skill:
- `graphify install --platform claude` copies SKILL.md + `references/` +
`.graphify_version` into `skills/graphify/`. Touches nothing else.
This is the recovery command.
`.graphify_version` into `skills/graphify/`, and appends a `# graphify`
block to `~/.claude/CLAUDE.md` = `CLAUDE.global.md` (graphifyy 0.9.67).
This is the recovery command; then delete that trailing block (one EOF
hunk in `git diff`), never check out the whole file.
- `graphify claude install` writes the CLAUDE.md graphify section and the
`.claude/settings.json` PreToolUse hooks. It **rewrites both guarded
configs** (EVAL-020, verified again 2026-09-15), so revert them after. It does NOT copy
the skill.
`.claude/settings.json` PreToolUse hooks in the current directory. It
**rewrites both guarded configs** (EVAL-020, verified again 2026-09-15),
so revert them after. It does NOT copy the skill.
`make plugin` runs both (`install-plugins.sh` STEP graphify) behind the
guarded-config EXIT trap, so a fresh clone is covered.
guarded-config EXIT trap, so a fresh clone is covered; `install-plugins.sh`
runs the second from `$REPO`, whatever the caller's cwd.
Trade-off accepted: an upstream release can now change the skill's prompt
with no diff to review. `skills/graphify/test-prompts.json` is hand-written
+9 -3
View File
@@ -50,9 +50,15 @@ code" wins. Repo-specific instructions override both.
Hacky fix → rebuild clean, no over-engineering.
## Session start
1. Read `.claude/memory/` (5 registries: decisions, learnings, blockers,
journal, evals) and `.claude/tasks/TODO.md`. Apply before touching anything.
2. Either missing → create it first (templates: `~/.claude/templates/memory/`).
1. Read `.claude/tasks/TODO.md`. The banner's `memory digest` lists open
blockers and the last journal line: apply both before touching
anything; a `+N` line → read those entries in `blockers.md`. No
digest (foreign repo, memory mod off) → list the open blockers
yourself.
2. Read a registry (`.claude/memory/`: decisions, learnings, blockers,
journal, evals) when the task needs it; planning flows scan them per
`~/.claude/lib/analyze-before-plan.md`.
3. Either missing → create it first (templates: `~/.claude/templates/memory/`).
## Workflow
- Confirm the approach only when real trade-offs exist (several valid
+5 -3
View File
@@ -36,9 +36,11 @@ source "$REPO/lib/gstack-links.sh"
# `# graphify` block to ~/.claude/CLAUDE.md = CLAUDE.global.md, which holds
# the curated `## graphify` section: it matches the heading and appends,
# it does not clobber) and `graphify claude install` (writes CLAUDE.md and
# .claude/settings.json in the caller's cwd, injecting aggressive MANDATORY
# .claude/settings.json in its own cwd, injecting aggressive MANDATORY
# hooks). The EXIT trap restores the 4 $REPO files in GUARDED_CONFIGS
# (fully effective when run from $REPO, e.g. `make plugin`). `claude plugin
# (Step 7 runs `graphify claude install` from $REPO in a subshell, so the
# trap covers its CLAUDE.md and .claude/settings.json writes whatever the
# caller's cwd). `claude plugin
# install` (Step 5) flips enable-states in settings.json. These 4 files are
# maintained by hand + commit, never by the installer. Snapshot them now and
# restore on exit so a run leaves them exactly as it found them. Pre-existing
@@ -688,7 +690,7 @@ if command -v graphify &>/dev/null; then
info "Running graphify install (dependencies)..."
graphify install 2>/dev/null || { warn "graphify install failed — run manually"; _graphify_ok=0; }
info "Configuring Claude Code integration..."
graphify claude install 2>/dev/null || { warn "graphify claude install failed — run manually"; _graphify_ok=0; }
(cd "$REPO" && graphify claude install) 2>/dev/null || warn "graphify claude install failed"
# Success message gated on the real outcome (LRN-071 class: an
# unconditional ok after `|| warn` lies when a step failed).
if [ "$_graphify_ok" -eq 1 ]; then
+5 -10
View File
@@ -4,18 +4,13 @@ paths: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.vue", "**/*.svelte",
# Web app security — specifics
Extends the global Security section (input validation, parameterized
queries, secrets in env vars, AuthN/AuthZ, fail closed). If a request
Extends `~/.claude/rules/secure-by-default.md` (always on). If a request
breaks one of these rules, say so instead of doing it.
- No API key in code shipped to the browser. Env vars, server-side only.
- The service/admin key never reaches the client: publishable key only.
- Row Level Security enabled on every table (Supabase/Postgres and kin).
- Authentication verified server-side, never only in the browser.
- No IDOR: changing an id in a URL must never expose another user's
data. Authorize object access on every request.
- Passwords hashed (bcrypt/argon2). Session cookies httpOnly + secure
+ sameSite.
- API responses return only the fields the client needs.
- Login rate limiting, upload restrictions (type/size), forced HTTPS,
security headers.
- Session cookies httpOnly + secure + sameSite.
- Uploads restricted by type and size.
- HTTPS forced.
- Security headers set.
+1 -1
View File
@@ -372,7 +372,7 @@ CAPITALIZE COMPLETE — <YYYY-MM-DD> (<pre-wipe flush | session-close>)
Then the closing line — pick by the STEP 5C persist result (`<mode>` = `Context
flushed` for pre-wipe, `Session closed` for ritual):
- **auto-persisted (push mode `auto`, finish rc 0 AND `ahead` = 0)** → `✅ <mode> + persisted to origin/develop (<short>). Next session: read .claude/memory/ at startup.`
- **auto-persisted (push mode `auto`, finish rc 0 AND `ahead` = 0)** → `✅ <mode> + persisted to origin/develop (<short>). Next session: TODO.md and the startup digest (open blockers, last journal line).`
On the `--no-push` path ONLY read TWO facts first, each its own Bash call: `bash "$HOME/.claude/lib/gitflow.sh" push-mode` and `git rev-list --count origin/chore/<name>..chore/<name> 2>/dev/null || echo unknown` (`branch_ahead`). `<push mode>` below is the verb's word. The WORKING-branch and rc 3 paths have no `chore/<name>` and never use the mode.