01 Infrastructure & Canonical Helper
01.0 Goal
One script, scripts/intel-query.sh, is the SSOT for all intelligence DB access from ori_lang. Every rule, skill, command, and hook that needs intelligence calls this script. No integration point ever checks Neo4j availability, activates the venv, or runs a Cypher query directly — that’s the helper’s job.
This follows the SSOT principle from .claude/rules/impl-hygiene.md: “every behavioral decision has exactly ONE file that defines it.”
Output contract (canonical — all references in this plan MUST match):
- Default format: JSON (for machine consumption by skills and rules)
--humanflag: raw text output for human-readable display — NOT JSON. Skills use--humanwhen query results will be held in Claude’s conversation context (Tier 1+2 integrations per Sections 03-04). Interactive CLI use also passes--human.- On success:
{"status":"ok","data":...}to stdout, exit 0 - On unavailable:
{"status":"unavailable","reason":"<reason>"}to stdout, exit 0 - Diagnostic/debug messages: stderr only, never stdout
Ownership split (important distinction):
- The shell script owns orchestration and graceful degradation — it sequences the availability checks (directory, venv, Docker, health-check) and returns structured unavailable JSON on any failure. Step 1 (directory check) is pure shell; steps 2-5 invoke Python for the neo4j import probe and health-check semantics.
- Python (
query_graph.py) owns health/status SEMANTICS — detailed graph queries, node counts, index verification, repo list, JSON formatting, and all query logic. The shell’s job is to orchestrate the check sequence and wrap failures; everything meaningful happens in Python.
These are distinct concerns. The shell answers “can I reach Neo4j?” The Python answers “what is the graph state?“
01.1 Canonical Helper Script
File: scripts/intel-query.sh
Contract:
Usage: scripts/intel-query.sh <command> [args...]
scripts/intel-query.sh search "pattern matching exhaustiveness"
scripts/intel-query.sh compare "type inference"
scripts/intel-query.sh cypher "MATCH (i:Issue) RETURN count(i)"
scripts/intel-query.sh status
scripts/intel-query.sh search "type inference" --human
Exit codes:
0 — always (graceful degradation)
Output (default JSON):
On success: {"status":"ok","data":...} to stdout
On unavailable: {"status":"unavailable","reason":"..."} to stdout
Diagnostic messages to stderr only
--human: raw text output (NOT JSON) — for conversation context and interactive display
Flags:
--human Switch to human-readable display format
--timeout N Override default 5s per-step timeout
Availability check sequence (all must pass, checked in order — cheapest first, each with 5s timeout):
../lang_intelligence/directory exists (filesystem check, instant)../lang_intelligence/.venv/bin/python -c "import neo4j"succeeds (venv has the package — must pass before we can use the driver)docker inspect lang-intelligence --format '{{.State.Running}}'returnstrue(container running)- Neo4j Bolt protocol readiness + auth:
../lang_intelligence/.venv/bin/python ../lang_intelligence/neo4j/query_graph.py --json health-check— a lightweight command that verifies TCP, Bolt handshake, AND auth using the configured credentials (readsNEO4J_URI/NEO4J_USER/NEO4J_PASSenv vars or defaults). Credentials stay in one place (Python), not duplicated inline in the shell script. - Full-text index verification:
CALL db.indexes() YIELD name WHERE name = 'issue_text' RETURN count(*) > 0— commandssearch,compare,fixed,patterndepend on this index fromschema.cypher
If any check fails, output the unavailable JSON and exit 0. The caller never sees an error.
Implementation checklist:
-
Create
scripts/intel-query.shwith the availability check sequence (steps 1-5 above) -
Each check step bounded by
timeout 5(or Pythonsocket.settimeout) — hanging Neo4j must not hang the script -
Parse
--timeout Nflag from caller arguments (default 5s) — use this variable in all bounded check steps; derive query timeout (QUERY_TIMEOUT = STEP_TIMEOUT * 6) for proxy and stats calls -
Proxy all arguments to
../lang_intelligence/.venv/bin/python ../lang_intelligence/neo4j/query_graph.py --json [args] -
Strip
--humanlocally — in human mode, omit--jsonwhen callingquery_graph.py(not forwarded as a flag) -
Add
statussubcommand that reports: Neo4j version, node/relationship counts, repo list, graph-emptiness check (warn if zero Issue nodes) -
Verify script is idempotent and safe to call from any directory (use
$(dirname "$0")for relative paths) -
Test: Neo4j running with data → returns JSON with
status:okand query results -
Test: Neo4j stopped → returns
{"status":"unavailable","reason":"container not running"}, exit 0 -
Test: lang_intelligence repo missing → returns unavailable JSON, exit 0
-
Test: venv missing neo4j package → returns unavailable JSON, exit 0
-
Test: Neo4j container running but DB not ready (Bolt handshake fails) → returns unavailable JSON, not hang
-
Test: Neo4j reachable but
issue_textfull-text index missing → returns unavailable JSON with reason indicating missing index -
Subsection close-out (01.1) — MANDATORY before starting 01.2:
- All tasks above are
[x]and the subsection’s behavior is verified - Update this subsection’s
statusin section frontmatter tocomplete - Run
/improve-toolingretrospectively on THIS subsection — Retrospective 01.1: no tooling gaps. Script gives clear JSON/text output on every failure path. Availability check sequence is straightforward (5 steps, cheapest first). Timeout handling via shelltimeoutis debuggable. No ori_lang diagnostic/testing tooling exercised. - Repo hygiene check — run
diagnostics/repo-hygiene.sh --checkand clean any detected temp files. Clean (2026-04-13).
- All tasks above are
01.2 Fix Existing query_graph.py Issues
Real issues found in ~/projects/lang_intelligence/neo4j/query_graph.py that must be fixed before any integration. Function names referenced below; use grep -n 'def func_name' neo4j/query_graph.py for current line numbers.
01.2a Error Handling & Robustness
- Unhandled Neo4j exceptions —
get_driver()is lazy: driver construction succeeds even when Neo4j is down; the realServiceUnavailableexception fires atsession.run()time inside each command function. Wrapping onlyget_driver()does nothing. Fix: wrap the command dispatch inmain()in a centralizedtry/except (ServiceUnavailable, AuthError, Exception)that prints an actionable error message and exits non-zero. This catches all command-level failures in one place. - No
try/finallyondriver.close()— every command function (e.g.,cmd_search,cmd_compare) callsdriver.close()at the end, but if the session query raises an exception,driver.close()is skipped and the connection leaks. Use context manager (with get_driver() as driver:) or try/finally. -
_parse_flagscallsint(args[i+1])on--limitand--depthvalues with no validation — non-numeric input raises an unhandledValueError. Validators now raiseValueError, caught bymain()’s centralized try/except. Also fix positional numeric args incmd_relatedandcmd_fix_chainwhich doint(args[1])— same pattern. - No connection timeout —
GraphDatabase.driver()uses default timeout, which can hang indefinitely if the Bolt port is open but the server is wedged. Addconnection_timeout=5to the driver constructor.
01.2b Missing Functionality
- Implement
health-checkcommand inquery_graph.py— a lightweight probe that verifies TCP + Bolt handshake + auth using the configured credentials (env vars or defaults). Returns JSON{"status":"ok"}on success,{"status":"error","reason":"..."}on failure. Exit 0 always. This is called byintel-query.shstep 4 to validate connectivity without running a full query. Also verify that the full-textissue_textindex exists (needed bysearch,compare,fixed,pattern). -
cmd_label_graphwas a TODO stub. Implement the label co-occurrence graph query or remove it from the usage docstring — a silently no-op command is a trap. - No
--jsonoutput mode — all commands print human-readable text to stdout. Add--jsonflag that makes every command output structured JSON instead. This is required byintel-query.shwhich needs machine-parseable results. - No graph-emptiness detection in
cmd_stats— if the graph has zero Issue nodes (e.g., after a freshschema.cypherwithout any data import),statsprints empty tables with no warning. Add a “graph is empty — run the fetch pipeline first” message. - Refactor
cmd_compareandcmd_patternto use_parse_flagsfor argument parsing — both used to do" ".join(args)which would include--jsonin the search terms. Using_parse_flagsto strip global flags before joining ensures--json(and future flags) are intercepted.
01.2c Hardcoded Configuration
-
Credentials hardcoded:
bolt://localhost:7687,neo4j,intelligencewere inline constants. Read from environment variables (NEO4J_URI,NEO4J_USER,NEO4J_PASS) with the current values as defaults. This allows different environments (CI, remote, Docker Compose with different ports) without editing source. -
Validate Python fixes: test
query_graph.py --limit fooexits cleanly with error message (not traceback), testquery_graph.py related rust notanumberexits cleanly, testquery_graph.py --json statsreturns valid JSON -
Subsection close-out (01.2) — MANDATORY before starting 01.N:
- All tasks above are
[x]and the subsection’s behavior is verified - Update this subsection’s
statusin section frontmatter tocomplete - Run
/improve-toolingretrospectively on THIS subsection — Retrospective 01.2: no tooling gaps. Work was entirely Python changes in an external project (~/projects/lang_intelligence/). Ori compiler tooling (diagnostics, test harness, scripts) was not exercised. No improvements needed. - Repo hygiene check — run
diagnostics/repo-hygiene.sh --checkand clean any detected temp files. Clean (2026-04-13).
- All tasks above are
01.R Third Party Review Findings
-
[TPR-01-001-codex][high]section-01-infrastructure.md:108— get_driver() is lazy; wrapping it won’t catch Neo4j failures. Resolved: Fixed on 2026-04-12. Rewrote 01.2a to target command dispatch, not get_driver(). -
[TPR-01-002-codex][high]section-01-infrastructure.md:46— LEAK between shell bootstrap and Python health logic. Resolved: Fixed on 2026-04-12. Added ownership split paragraph; shell does availability CHECK, Python does health SEMANTICS. Step 4 now callsquery_graph.py health-checkinstead of inline probe. -
[TPR-01-003-codex][medium]section-01-infrastructure.md:42— Success JSON contract DRIFT (command field inconsistent). Resolved: Fixed on 2026-04-12. Removedcommandfield from canonical contract; unified across all locations. -
[TPR-01-004-codex][medium]section-01-infrastructure.md:110— Missing numeric validation in cmd_related/cmd_fix_chain. Resolved: Fixed on 2026-04-12. Expanded _parse_flags item to cover positional args. -
[TPR-01-005-codex][low]00-overview.md:150— Overview Known Issues lists only 5 of 8 items. Resolved: Fixed on 2026-04-12. Added 3 missing issues to overview. -
[TPR-01-001-gemini][medium]section-01-infrastructure.md:108— Incorrect line numbers for query_graph.py references. Resolved: Rejected after verification on 2026-04-12. Line numbers in plan are correct: get_driver IS at 35-36, _parse_flags int() IS at 53, label-graph IS at 444. Gemini confabulated incorrect alternatives. -
[TPR-01-002-gemini][high]section-01-infrastructure.md:116— cmd_compare and cmd_pattern bypass _parse_flags; —json flag would be included in search terms. Resolved: Fixed on 2026-04-12. Added new 01.2b item requiring refactor of cmd_compare/cmd_pattern to use _parse_flags. -
[TPR-01-003-gemini][low]00-overview.md:157— label-graph line number wrong (claims 332). Resolved: Rejected after verification on 2026-04-12. Label-graph is at line 444, not 332. Gemini confabulated. -
[TPR-01-004-gemini][medium]section-01-infrastructure.md:41— —human flag behavior ambiguous. Resolved: Fixed on 2026-04-12. Clarified: —human returns raw text (NOT JSON); added to contract and success criteria. -
[TPR-01-005-gemini][medium]00-overview.md:150— Overview missing 3 issues (near-agreement with TPR-01-005-codex). Resolved: Fixed on 2026-04-12. Same fix as TPR-01-005-codex. -
[TPR-01-006-gemini][medium]section-01-infrastructure.md:19— 01.R and 01.N missing from frontmatter sections. Resolved: Fixed on 2026-04-12. Added both to sections array. -
[TPR-01-007-gemini][high]section-01-infrastructure.md:96— Close-out blocks not in canonical checklist format. Resolved: Fixed on 2026-04-12. Replaced prose with canonical close-out checklist per plan-schema.md. -
[TPR-01-008-gemini][high]section-01-infrastructure.md:133— Missing plan-sync and annotation-cleanup in completion checklist. Resolved: Fixed on 2026-04-12. Added both items to 01.N. -
[TPR-01-001-codex][high](iter2)section-01-infrastructure.md:90— —health-check not in 01.2 tasks. Resolved: Fixed on 2026-04-12. Added —health-check implementation task to 01.2b. -
[TPR-01-002-codex][medium](iter2)section-01-infrastructure.md:29— 01.C should be 01.N per schema. Resolved: Fixed on 2026-04-12. Renamed all 01.C references to 01.N. -
[TPR-01-003-codex][medium](iter2)section-01-infrastructure.md:91— Missing index-absent test scenario. Resolved: Fixed on 2026-04-12. Added 6th test scenario and updated completion checklist count. -
[TPR-01-001-gemini][medium](iter2)section-01-infrastructure.md:188— Missing index.md sync in plan-sync. Resolved: Fixed on 2026-04-12. Added index.md update item. -
[TPR-01-002-gemini][medium](iter2)00-overview.md:150— cmd_compare/_parse_flags not in overview. Resolved: Fixed on 2026-04-12. Added to Known Issues. -
[TPR-01-003-gemini][high](iter2)section-01-infrastructure.md:126— —health-check not in 01.2 tasks. Resolved: Fixed on 2026-04-12. Same fix as iter2 TPR-01-001-codex (near-agreement). -
[TPR-01-004-gemini][medium](iter2)section-01-infrastructure.md:189— Missing Exit Criteria block. Resolved: Fixed on 2026-04-12. Added Exit Criteria paragraph. -
[TPR-01-001-codex][medium](iter3)index.md— index.md has no per-section status table; only keyword clusters. Resolved: Fixed on 2026-04-12. Added Quick Reference table to index.md before keyword clusters section. -
[TPR-01-002-codex][low](iter3)00-overview.md:5— overview frontmatter status stillnot-startedwith section 01 in-progress. Resolved: Fixed on 2026-04-12. Updated overview frontmatter status toin-progressand Quick Reference table row 01 toin-progress. -
[TPR-01-003-codex][low](iter3)00-overview.md:102— Implementation Sequence says “everything else depends on section 01” but sections 05-09 havedepends_on: []. Resolved: Fixed on 2026-04-12. Changed “everything else depends on this” to “sections 02-04 depend on this”. -
[TPR-01-001-gemini][low](iter3)section-01-infrastructure.md:112— close-out/improve-toolingbullet lacks conventional-commit type guidance. Resolved: Fixed on 2026-04-12. Expanded both 01.1 and 01.2 close-out/improve-toolingbullets with conventional-commit type list and explicittools(...)rejection note. -
[TPR-01-002-gemini][low](iter3)section-01-infrastructure.md:202— 01.N section-close sweep bullet is bare; no guidance on what to verify or how to commit. Resolved: Fixed on 2026-04-12. Expanded 01.N/improve-toolingsection-close sweep item with cross-subsection pattern guidance and conventional-commit type requirements. -
[TPR-01-003-gemini][medium](iter3)section-01-infrastructure.md:97—--timeout Nflag described in contract but not in 01.1 implementation checklist. Resolved: Fixed on 2026-04-12. Added--timeout Nparsing task to 01.1 implementation checklist after the bounded-check-step item. -
[TPR-01-004-gemini][medium](iter3)section-01-infrastructure.md:139— No test validation item for the Python fixes in 01.2. Resolved: Fixed on 2026-04-12. Added validation item before 01.2 close-out block covering —limit, positional numeric, and —json tests. -
[TPR-01-005-gemini][rejected](iter3)section-01-infrastructure.md— Claimeddepends_on: []on section-01 frontmatter was incorrect (should list itself as a dependency). Resolved: Rejected on 2026-04-12.depends_on: []on section 01 is correct — it has no dependencies. A section cannot depend on itself. -
[TPR-01-001-codex][high](close-out)scripts/intel-query.sh:37— GAP:--timeoutwithout value causes infinite loop (shift 2fails, while loop spins). Resolved: Fixed on 2026-04-12. Added numeric validation and graceful fallback to default for missing/non-numeric--timeoutvalues. -
[TPR-01-002-codex][high](close-out)scripts/intel-query.sh:49— LEAK:unavailable()hand-rolls JSON escaping via sed (misses newlines/control chars → malformed JSON). Resolved: Fixed on 2026-04-12. Replaced sed escaping withpython3 -c json.dump(...)for proper JSON serialization. -
[TPR-01-003-codex][medium](close-out)query_graph.py:83— GAP:_parse_flagssilently absorbs dangling flags (--limitwith no value → becomes search term). Resolved: Fixed on 2026-04-12. Added missing-value checks that raise ValueError, caught by main()‘s try/except. -
[TPR-01-004-codex][medium](close-out)section-01-infrastructure.md:98— DRIFT: Plan claims--timeout Nis passed toquery_graph.pyvia argument; implementation only uses it for shell probes. Resolved: Fixed on 2026-04-12. Updated plan claim to match reality (shell-side bounded probes + derived QUERY_TIMEOUT for proxy calls). -
[TPR-01-001-gemini][high](close-out)scripts/intel-query.sh:105— Proxy execution swallows Python’s structured error JSON, returns generic “query failed”. Resolved: Fixed on 2026-04-12. Proxy now extractsreasonfrom Python’s JSON error output when available. -
[TPR-01-002-gemini][medium](close-out)query_graph.py:44— Argument validation (_parse_int, command validators) bypassesjson_mode— prints to stderr +sys.exit(1). Resolved: Fixed on 2026-04-12. Changed all validators to raise ValueError; caught by main()‘s try/except → routed through_handle_error(msg, json_mode). -
[TPR-01-003-gemini][medium](close-out)scripts/intel-query.sh:31— Unsafe manual JSON construction (near-agreement with TPR-01-002-codex close-out). Resolved: Fixed on 2026-04-12. Same fix as TPR-01-002-codex close-out (python3 json.dump). -
[TPR-01-001-codex][medium](close-out-2)query_graph.py:702— GAP:query_graph.py --json(no command) crashes with IndexError;--jsonstripped before length check. Resolved: Fixed on 2026-04-12. Moved--jsonstripping before thelen(argv) < 2check; returns JSON error in json_mode. -
[TPR-01-002-codex][low](close-out-2)section-01-infrastructure.md:119— DRIFT: Stale line references in 01.2 checklist (shifted after fixes). Resolved: Fixed on 2026-04-12. Removed fragile line numbers; use function names as stable identifiers with grep instructions. -
[TPR-01-001-gemini][informational](close-out-2)scripts/intel-query.sh:1— All 7 fixes verified successfully; no architectural violations found. Proof-of-work from thorough re-review pass. -
[TPR-01-001-codex][medium](close-out-3)scripts/intel-query.sh:41— GAP:--timeout 0disables GNU timeout, breaking bounded-call guarantee. Resolved: Fixed on 2026-04-12. Added minimum-of-1 guard:$(( $2 > 0 ? $2 : 1 ))so--timeout 0is clamped to 1s. -
[TPR-01-002-codex][low](close-out-3)section-01-infrastructure.md:237— DRIFT: test-all pass count stale (17120 vs 17140). Resolved: Fixed on 2026-04-12. Updated count to 17140 (current HEAD). -
[TPR-01-001-codex][medium](close-out-4)scripts/intel-query.sh:43— GAP: Bash octal trap in--timeoutarithmetic —$(( $2 ))treats08/09as invalid octal. Resolved: Fixed on 2026-04-12. Added10#base-10 prefix:$(( 10#$2 > 0 ? 10#$2 : 1 )). -
[TPR-01-001-gemini][high](close-out-4)scripts/intel-query.sh:42— GAP: Same octal trap as TPR-01-001-codex (near-agreement). Resolved: Fixed on 2026-04-12. Same fix as TPR-01-001-codex close-out-4. -
[TPR-01-002-gemini][low](close-out-4)section-01-infrastructure.md:246— DRIFT: test-all count 17140 vs 17142. Resolved: Rejected on 2026-04-12. Count 17140 is correct for committed HEAD; 17142 reflects uncommitted parallel-session tests in working tree. -
[TPR-01-001-codex][low](close-out-5)section-01-infrastructure.md:90— DRIFT:--health-checkspelling throughout plan; actual CLI is positionalhealth-check. Resolved: Fixed on 2026-04-12. Replaced all--health-checkwithhealth-check(except historical TPR finding titles). -
[TPR-01-002-codex][low](close-out-5)section-01-infrastructure.md:53— DRIFT: Ownership paragraph claims shell avoids starting Python; steps 2+4 invoke Python. Resolved: Fixed on 2026-04-12. Rewrote ownership paragraph to reflect actual orchestration-with-Python design. -
[TPR-01-003-codex][low](close-out-5)section-01-infrastructure.md:100— DRIFT: Checklist says--humanis “passed through”; actually stripped locally. Resolved: Fixed on 2026-04-12. Changed to “Strip--humanlocally — omit--jsonin human mode.” -
[TPR-01-001-gemini][informational](close-out-5)scripts/intel-query.sh:43— Confirms timeout arithmetic fix is complete and correct for all edge cases. -
[TPR-01-001-codex][low](close-out-6)00-overview.md:155— DRIFT: Known Issues block still lists 10 resolved query_graph.py defects. Resolved: Fixed on 2026-04-12. Collapsed resolved items into single resolved-summary line. -
[TPR-01-001-codex][medium](close-out-7)scripts/intel-query.sh:157— GAP: Human-mode status and proxy branches bypass QUERY_TIMEOUT — can hang indefinitely. Resolved: Fixed on 2026-04-12. Addedtimeout "$QUERY_TIMEOUT"to human-mode stats (line 157) and proxy (line 188) branches. -
[TPR-01-001-codex][medium](close-out-8)scripts/intel-query.sh:157— GAP: Human-mode timeout failures silently swallowed — nounavailable()reporting. Resolved: Fixed on 2026-04-12. Added RC check + stderr error message for both human-mode branches. -
[TPR-01-002-codex][low](close-out-8)scripts/intel-query.sh:167— GAP: No-command human help path lacks timeout wrapper. Resolved: Fixed on 2026-04-12. Addedtimeout "$STEP_TIMEOUT"to help invocation. -
[TPR-01-001-gemini][medium](close-out-8)scripts/intel-query.sh:167— GAP: Same help-path timeout gap (near-agreement with TPR-01-002-codex). Resolved: Fixed on 2026-04-12. Same fix as TPR-01-002-codex close-out-8. -
[TPR-01-001-codex][medium](close-out-9)scripts/intel-query.sh:170— GAP: Help path|| trueswallows rc=124 timeouts alongside expected rc=1. Resolved: Fixed on 2026-04-12. Replaced|| truewith explicit RC check: rc=1 silent (expected help), rc=124 → stderr timeout msg, rc>1 → stderr crash msg. -
[TPR-01-001-gemini][informational](close-out-9)scripts/intel-query.sh:1— Proof-of-work: all timeout + error-handling paths verified via 4 targeted tests. -
[TPR-01-001-codex][high](close-out-10)scripts/intel-query.sh:64— GAP: Barepython3helper subprocesses (unavailable(), JSON parsers, status assembly, version parser, reason extractor) lack timeout wrappers — proven via dynamic fault injection. Resolved: Fixed on 2026-04-12. Addedtimeout "$STEP_TIMEOUT"to ALL 7 bare python3 calls; added pure-bash fallback in unavailable() for python3 failure. -
[TPR-01-002-codex][low](close-out-10)section-01-infrastructure.md:266— DRIFT: Output-contract checklist item overstates cleanliness given finding 1. Resolved: Fixed on 2026-04-12. Finding 1 resolved — all python3 helpers now bounded. -
[TPR-01-001-gemini][informational](close-out-10)scripts/intel-query.sh:26— Proof-of-work: 5 targeted edge-case tests all passed.
01.N Completion Checklist
-
scripts/intel-query.shexists, executable, passes all 6 test scenarios (running, stopped, missing repo, missing venv, Bolt-not-ready, index-missing) -
query_graph.pyhealth-checkcommand implemented and used byintel-query.shstep 4 -
query_graph.pyissues fixed: driver error handling, driver.close() leak, _parse_flags validation, connection timeout -
query_graph.pylabel-graph command implemented (not a stub) -
query_graph.py—json output mode works for all commands -
query_graph.pycredentials read from env vars with current values as defaults -
scripts/intel-query.sh statusreturns live graph stats including emptiness check - Output contract is JSON-by-default everywhere — no command returns unstructured text to stdout in default mode
- No test regressions:
timeout 150 ./test-all.sh(17140 passed, 0 failed) -
/tpr-reviewclean — 8 iterations, 56 findings fixed (accepted at iteration 8/10 after convergence + dynamic fault injection rigor) -
/impl-hygiene-reviewclean — shell script scope; no Rust-specific findings; script well-structured after 8 TPR rounds -
/improve-toolingsection-close sweep — MANDATORY after both reviews are clean. Verify every subsection (01.1, 01.2) has an “improvements made” entry or a documented “no gaps” finding from its per-subsection retrospective. Look for cross-subsection patterns: command sequences repeated across subsections, integration failures with unhelpful messages, instrumentation that became obvious only after seeing both subsections. Implement immediately via separate/commit-pushusing valid conventional-commit types (build/test/chore/ci/docs— NOTtools(...)). - Plan annotation cleanup: Run
plan-annotations.sh --cleanup-only --plan lang-intelligence— zero stale annotations - Plan sync:
- Update section 01 frontmatter
statustocomplete - Update
index.mdsection status - Update
00-overview.mdQuick Reference table — Section 01 status - Update
00-overview.mdmission success criteria checkboxes - Verify Section 02’s
depends_on: [01]is still accurate
- Update section 01 frontmatter
Exit Criteria: scripts/intel-query.sh search "type inference" returns valid JSON with status:ok when Neo4j is running, and scripts/intel-query.sh search "type inference" returns {"status":"unavailable","reason":"..."} with exit 0 when Neo4j is stopped. All 6 test scenarios pass. query_graph.py health-check returns {"status":"ok"} when connected. query_graph.py --json stats returns structured JSON. timeout 150 ./test-all.sh green.