chore(memory): BDR-097 graphify threshold, LRN-162 graphify measurements, journal + TODO 2026-09-24

This commit is contained in:
bastien
2026-09-24 12:12:16 +02:00
parent c81b1731af
commit 566fcfe1ec
4 changed files with 36 additions and 0 deletions
+8
View File
@@ -1214,3 +1214,11 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate).
- **Status**: accepted, on feature/branch-delete-guard, UNMERGED (human gate). gitflow-test 152/154 (2 pre-existing T16a, gitleaks absent), T22 12/12 + T23 11/11, shellcheck clean incl. emitted hook, doctor 4/4 hooks match. Hook LIVE machine-wide via global `githooks/` while the branch is checked out (symlink follows the checkout).
- **Reference**: `lib/gitflow.sh`, `lib/gitflow-test.sh` T22/T23, `githooks/reference-transaction`, `.githooks/reference-transaction`, `settings.json`, `doctor.sh`, `skills/gitflow/SKILL.md`, `CLAUDE.global.md`, `templates/settings/SETTINGS.md`. Extends [[BDR-095]]; links [[LRN-161]], [[LRN-114]].
- **Amendment 2026-09-24 (user go: "nettoie aussi les branches distantes une fois mergées")**: `_gitflow_delete_remote` runs after the local delete — `ls-remote --exit-code` reads the remote tip, `gitflow_merged_into_base <tip>` re-checks it (unknown or unmerged sha → remote copy KEPT, loud), then `push origin --delete`. Best effort like the pushes: no origin / `GITFLOW_NO_PUSH=1` / `gitflow.autopush false` → skip; unreachable or refused → "NOT removed" + the hand command, rc 0. Explicit protected-base guard inside the helper too. Static deny on hand `git push --delete` UNCHANGED: it matches the Bash tool's command string, the lib's sub-process is the sanctioned path (prose says so). Rejected: making a failed remote delete fail `finish` (merge done, local gone → nothing to roll back; loud is enough); deleting without re-checking the remote tip (a push from another clone would be lost). T24 9/9, suite 161/163 (2 pre-existing T16a). Live: origin/feature/branch-delete-guard + origin/feature/destructive-guardrails removed by `gitflow.sh delete` (both tips verified merged), bases untouched. On feature/remote-branch-cleanup, UNMERGED (human gate).
## BDR-097 — graphify from 200 tracked code files: the banner informs, the user decides
- **Date**: 2026-09-24
- **Decision**: deterministic threshold, not AI judgment. `lib/graphify-gate.sh`: `git ls-files` code extensions (graphify's AST set), vendored trees (`vendor|node_modules|third_party|dist|build`) excluded, ≥ 200 AND no `graphify-out/graph.json` → one banner-sized line `graphify? N code files ≥ 200, no graph` + `→ /graphify (AST, seconds) — you decide` in session-start. Nothing built, installed or updated by the hook. Doctrine: CLAUDE.global.md graphify § carries the threshold + "never `graphify claude install` without a go"; plugin-advisor thresholds stop pre-enabling graphify at scaffold time. `GRAPHIFY_MIN_CODE_FILES` overrides (tests).
- **Why**: user question "when is graphify worth it, can the AI suggest it, even set it up". Measured first ([[LRN-162]]): value = localisation (who calls what), not editing (the file is read anyway); code-only build is free (AST), docs cost session tokens; a query costs 2-3k tokens ≈ two file reads. Below ~200 files grep beats the graph. User's own words: "tu informes, je décide" — an AI-estimated trigger is judgment (irreproducible, invisible when silent), a count is a rule. Fits `graphify-out/` being a per-project write the user owns.
- **Alternatives rejected**: AI "estimates the project needs graphify" → not reproducible. Auto-build at threshold → writes ~8 MB into the project, user's decision. Interconnection metric (import graph density) → needs the graph itself to compute; file count is the honest proxy. Post-commit `graphify update` in the gitflow hooks → deferred to a pilot (user picked the inform-only compromise); note `update` refuses a smaller graph without `--force`, and `graphify hook install` is inert under the global `core.hooksPath`. `graphify claude install` → rejected again (PreToolUse nudges on every Read/Glob = the context tax, [[BDR-028]]).
- **Status**: accepted, on feature/graphify-threshold-banner, UNMERGED (human gate). Test 11/11, shellcheck clean; live: this repo silent (74 files), robin_petier fires (214).
- **Reference**: `lib/graphify-gate.sh`, `lib/tests/graphify-gate.test.sh`, `hooks/session-start.sh`, `CLAUDE.global.md` § graphify, `agents/plugin-advisor.md`, CHANGELOG. Links [[LRN-162]], [[BDR-028]], [[BDR-021]] (conditional graphify rules).
+1
View File
@@ -499,3 +499,4 @@ rules:
- feature/branch-delete-guard merged into develop on user go, `gitflow finish` → b2e252e, pushed by the lib + post-merge hook (develop == origin/develop, no hand push). First live run of `gitflow_delete`: branch verified merged → deleted. User asked "push automatically after every merge": already the case since [[BDR-095]] (`_gitflow_merge_into` pushes the target, post-merge hook, T18f) — evidenced, nothing added. Remote `origin/feature/{branch-delete-guard,destructive-guardrails}` remain (`push --delete` denied) — user's call.
- User go: remote copy cleaned too. `_gitflow_delete_remote` (tip re-checked against the bases before `push --delete`, best effort, loud KEPT/NOT removed), T24 9 checks, prose + doctrine + SKILL + docs. 161/163. Live run through the lib on the two stale merged remotes: origin/feature/branch-delete-guard + origin/feature/destructive-guardrails removed by `gitflow.sh delete` (both tips verified merged), bases untouched. Branch feature/remote-branch-cleanup UNMERGED — human gate. BDR-096 amended.
- feature/remote-branch-cleanup merged into develop on user go, `gitflow finish` → 91859fe, pushed (develop == origin/develop). First `finish` with the remote step live: it removed `origin/feature/remote-branch-cleanup` itself (tip verified merged). origin holds no `feature/*` any more. BDR-096 fully shipped.
- graphify: user asked when it is worth it + whether to automate suggestion/setup/update. Measured on a scratch copy of robin_petier ([[LRN-162]]): AST build 2.3 s / 0 tokens, query 2-3k tokens, `.claude/` noise, SQL grammar missing, `update` refuses smaller graphs, `hook install` inert under global hooksPath. Opinion given: value = localisation not editing; real context eaters are registries + always-on rules. User rule: from 200 code files, inform only ([[BDR-097]]) → `lib/graphify-gate.sh` + session-start banner line + doctrine + advisor, test 11/11. Branch feature/graphify-threshold-banner UNMERGED — human gate.
+7
View File
@@ -1520,3 +1520,10 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s
- **Pattern**: (a) a safety check whose reference point is configurable changes meaning when config moves elsewhere — auto-push broke `-d` with zero diff in the delete code. Verify "merged" explicitly against the NAMED base: `git merge-base --is-ancestor <br> <base>`. (b) probing a guardrail inline gets blocked BY the guardrail: deny strings (`core.hooksPath`, `GIT_CONFIG_GLOBAL=`, `rm -rf "$VAR"`, `branch -D develop`) are matched in the command text, heredocs included → 4 denials this session. Probe = a test in the suite (file, run via `make test`), the TDD path anyway; file content via the Write tool, command line clean. (c) `reference-transaction` hook: line `<old> <new> <ref>` in `prepared`; `branch -d` passes an all-zero old oid ("force" semantics) → ref NAME + all-zero NEW is the only reliable deletion signal; a merged check cannot live there.
- **Future application**: any change to upstream/push config → re-read every `-d`, `--ff-only`, `@{u}`-relative guard. New destructive capability → static deny + mechanical check + prose, in that order ([[LRN-160]]). Guardrail probes → test file, never inline; a denied probe is the guard working, not a bug to route around.
- **Reference**: [[BDR-096]], [[BDR-095]], `lib/gitflow-test.sh` T22a/T23, git-branch(1), githooks(5) reference-transaction.
## LRN-162 — graphify measured: free AST map, paid semantic pass, 2-3k tokens per query, noise from `.claude/`
- **Date**: 2026-09-24
- **Context**: user asked whether graphify saves context ("agents re-read the whole codebase per feature"). Built the graph of a scratch copy of robin_petier (PHP, 295 files) with the CLI only: `graphify update .` (no skill pipeline, no LLM).
- **Pattern**: (a) code-only build 2.3 s, 0 tokens, 3141 nodes / 7241 edges / 199 communities; hubs correct without any LLM (Auth, Database, Router, PDO, PHPMailer). Incremental update 1.9 s. `graphify-out/` = 8 MB (graph.json 4.4 + graph.html 3.5) → gitignore it. (b) one `graphify query` ≈ 2000-3000 tokens (default budget 2000, over-budget answers spill; truncation at 70/245 nodes on broad questions) = the price of two file reads; it maps (name, file:line), it does not replace reading the file you edit. Value = localisation, not editing. (c) it indexed `.claude/` (contracts, PROCEDURE.md, registries): an "authentication" query surfaced a mobile-nav contract → `.graphifyignore` (`.claude/`, `docs/superpowers/`; gitignore semantics, can only exclude more). (d) 13 `.sql` files contributed nothing: `tree_sitter_sql` missing → `pipx inject graphifyy "graphifyy[sql]"`. (e) `update` refuses to write a graph with FEWER nodes unless `--force`/`GRAPHIFY_FORCE=1` → after a refactor that deletes code, an automated update goes stale silently. (f) `graphify hook install` targets the repo's hooks dir; under our global `core.hooksPath` it is inert → our generated post-commit hook is the only integration point. (g) `graphify claude install` = PreToolUse nudges on every Read/Glob + CLAUDE.md rewrite — the context tax itself. (h) the semantic pass (docs/papers) runs on the host agent = session tokens; code-only stays free.
- **Future application**: measure a "context saver" before adopting it — build time, artifact size, tokens per use, noise sources. Threshold rule [[BDR-097]]: propose from 200 tracked code files, never below. Pilot recipe when the user says go: `graphify update .` + `.graphifyignore` + gitignore `graphify-out/` + `GRAPHIFY_FORCE=1 graphify update .` in the post-commit hook, guarded by `[ -f graphify-out/graph.json ]`.
- **Reference**: [[BDR-097]], [[BDR-028]], `lib/graphify-gate.sh`, graphify 0.9.65 (`detect.py` `_SKIP_DIRS`, `.graphifyignore`; `hooks.py` core.hooksPath handling; `__main__.py` PreToolUse nudge payloads).