Skip to Content
Recodocs

AI architecture review

What does a printed-rule review of the synthetic Lumen Habits backend establish before any code change?

7 min read

The question, and who it is for

A useful review ties a finding to the code it observed. Distinguish what the source establishes, what the reviewer inferred and what still needs a runtime test.

The set is seven notebooks that review an unfamiliar AI backend from source text. The subject is Lumen Habits (synthetic), the consumer-app dataset under examples/architect-common/. The vendored backend is examples/architect-common/fixtures/lumen-backend/. Planted weaknesses are listed in examples/architect-common/fixtures/seeded-weaknesses.json. The set reads that directory read-only and does not create or edit it. The SQLite file is git-ignored and regenerable by the dataset's own generator.

The review is a deterministic workflow. Every classification, finding and mapping is computed from the call sites and the rules the notebook prints. Only notebook 07 has a model, on the Codex-credit route, and it drafts pairing notes from the review's findings. The model chooses no action.

An architect uses notebooks 01 and 04 to list every AI call site from the code, then map each weakness to the recohut-kit owner of the fix. A technical lead uses notebooks 02, 03 and 07 for the classification ledger, the findings, and pairing notes for the in-house engineer. A backend engineer uses notebook 05 to fold three hard-coded workflows into one parameterised capability. A product owner uses notebook 06 so regression checks land first, and each step names its rollback and its owner.

Notebooks 01 to 06 are route scripted, call cap 0 model calls. Notebook 07 is Codex live, Codex-credit route, no ceiling, with each call's receipt recorded. The browser checkpoint column is None on every row.

How to run it

From the kit root (recohut-kit):

uv venv .venv-ai-architecture-review
uv pip install --python .venv-ai-architecture-review/bin/python -e '.[codex,ticketing]' pandas nbconvert ipykernel ruff
.venv-ai-architecture-review/bin/python -m ipykernel install --user --name ai-architecture-review

The environment is .venv-ai-architecture-review and the kernel is ai-architecture-review. ruff is installed because the shared notebook checker runs python -m ruff from the set interpreter. The ticketing extra supplies the kit's ticketing module (httpx and pydantic). No existing dependency pin or pyproject.toml value is changed.

scripts/check_ai_architecture_review_notebooks.py enforces README order. Execute each notebook once, in that order. The README records this command, used on 2026-10-20:

.venv-ai-architecture-review/bin/jupyter nbconvert --to notebook --execute --inplace --allow-errors \
  --ExecutePreprocessor.timeout=900 --ExecutePreprocessor.kernel_name=ai-architecture-review \
  examples/ai-architecture-review/<notebook>.ipynb

No browser handoff is requested. Then, from the kit root:

.venv-ai-architecture-review/bin/python scripts/check_ai_architecture_review_notebooks.py
.venv-ai-architecture-review/bin/python scripts/check_ai_architecture_review_notebooks.py --executed

Notebooks write only under examples/ai-architecture-review/.runtime/<notebook-stem>/, which this set's .gitignore ignores. The backend is read as text and never imported or run.

Notebooks in order

NotebookWhat it doesRecorded output
01-call-site-inventory-of-an-unfamiliar-ai-backend.ipynbLists every AI call site with its file, function and what it sends to the model.yes
02-model-deterministic-tool-classification-ledger.ipynbClassifies 28 sites, leaves 14 unknown, and places the other 14 as deterministic, hard-coded, model-decided, or reusable tool, with a rule and evidence line on supported verdicts.yes
03-weakness-findings-with-evidence.ipynbReports each planted weakness with file location and observed symptom.yes
04-target-architecture-mapped-to-kit-owners.ipynbMaps each weakness to the recohut-kit owner that would own its fix.yes
05-reusable-capability-from-hard-coded-workflows.ipynbFolds three hard-coded workflow variants into one parameterised capability.yes
06-migration-plan-regression-first.ipynbOrders migration so regression checks land first; each step names rollback and owner.yes
07-review-handoff-and-pairing-notes-codex-live.ipynbA Codex-credit model drafts pairing notes. Each call's receipt is recorded. The model chooses no action.yes

Saved files are marked with recorded outputs: 14, 13, 16, 10, 17, 15 and 14. None of the seven is marked as having no recorded output.

What the recorded outputs show

Notebook 01 prints 41 files on disk, 31 Python and 5 TypeScript, folders backend and edge. Defaults find effect 8, prompt_template 5, tool_definition 2, and 0 model-call sites (0 of 12 ground-truth sites). Two httpx.post lines in backend/app/llm/client.py (14 and 22) are read as effect. Eight Lumen patterns then print 28 sites; the defaults had found 15. The kind line after that total is cut off.

Notebook 02 prints 9 rules: 4 default, 5 Lumen, then 28 sites classified: 14 supported and unknown: 14. Placements are deterministic 2, hard_coded_should_not_be 4, model_decides 6, reusable_tool 2 and unknown 14. A transcribed supported line places model_call@backend/app/coach/chat.py:15 as model_decides under rule open-text-or-closed-record-is-model.

Notebook 03 prints 12 pattern detectors active; the kit ships 11. no_approval_before_consequence is declared not applicable: policies name only export_data as needing a human. Findings are 13 across 10 kinds. Transcribed rows run from F01 high business_rule_in_prompt at backend/app/llm/prompts.py:3 through F06 medium untyped_tool_arguments. F01's evidence text includes a free-tier cap of 3 habits and a streak above 21 days.

Notebook 04 prints 12 kinds in the table; 12 from the kit and Lumen rows added: 5. Mapping is 13 findings -> 25 owner rows, 25 mapped. F01 is starred on recohut_kit.assistant.tools.AppTool. F02 lists ToolPolicy and Outbox, with the star on recohut_kit.harness.action_lifecycle.ActionLifecycle. recohut_kit.claims and recohut_kit.user_context both print importable True; used True. Statuses present are mapped only. Findings with no existing or added owner: 0.

Notebook 05, scenario h, prints Three hard-coded workflow variants that should be one capability, then four True assertions: 3 foldable variants, 1 shared shape hash, the single variant a different shape (expected 0, got 0), and 3 differing windows. Candidate model calls in backend/app/workflows/: 4. Folded capabilities: 1. Refused shapes: 1. export_digest is not folded because 1 variant shares that shape and the rule needs 2. Folded names are goal_reset, onboarding_plan and weekly_review. Merged inputs are check_in_window (28, 7, 14), kind_label (goal reset, first-week plan, weekly review) and record_key.

Notebook 06 prints recohut_kit.evals, recohut_kit.scenarios and recohut_kit.redteam as importable. examples/agent-scenarios and examples/red-team-scenarios both have the set folder and the ledger folder. The cell prints results claimed here from those sets: none. It prints 10 regression names for 10 finding kinds, including ev_s_badge (dataset eval case), reg-typed-habit-update (authored from the backend's tool comment) and lumen-regression-suite (the suite itself). The cell prints suite lumen-regression-suite: 9 scenarios, 7 personas and a digest beginning 148c83f09c0fb194. Three transcribed scenarios are critical: ev_s_badge, ev_i_dup and ev_e_refused.

Notebook 07's transcribed cells recap 28 sites, 12 model calls, the same ledger counts, 13 findings, 25 target rows, 1 folded capability and 13 steps, regression first. Handoff sections are inventory 28 lines, ledger 28, findings 13, target 25, capabilities 2, plan 13 and not verified 4. verify_handoff ok True; refused lines 0. The writer sees 46 lines in a prompt of 47 lines and 7273 characters; every writer line carries references; the output-token cap is 3000.

What is not shown or not run

Saved output for notebook 07 stops at that writer-prompt cell. The next cell constructs CodexAuth on CODEX_CONNECTION_DIR, and no output line follows. If the connection is unavailable the notebook prints Codex live unavailable in this run and makes no call. The stored-run sentence stops at In this stored run the connection was.

The README says the first run on 2026-10-20 printed evidence only (all 7 ran, nbconvert exit 0, no error cells), and the same-day re-run enforced every Proof claim with an assertion, clean for all 7. The static and --executed checkers passed on that run. It says notebook 07 made one Codex-credit call, receipt codex-usage.jsonl: five of six notes were unknown_ref on the first run, and all six were (0 cited) on the hardening re-run. The notebook asserts that every note is judged and that flagged notes are counted, and it does not require the model to cite correctly.

Saved lines also stop early for notebook 01's kind counts after 28 sites, notebook 04's owner_unavailable and unmapped print, and notebook 06's verify_plan print.

No cloud resource is planned, so no ledger cleanup cell applies, and no loopback listener is planned. No browser checkpoint is declared. No third-party account is created and no provider key is used. Every third-party platform, if a notebook needs one, is represented by a recorded stand-in over documented shapes, labelled recorded, not a capture of a real account.

The Lumen rules were fitted after the answer key was seen, so the results show the evidence discipline on a fixture, not discovery. The ScenarioFile in notebook 06 is contract-only. The evaluation fleet's loader and runner were not run. Notebook 06 says the import check does not prove the gate passes. Notebook 04 says it does not exercise claims and user_context. Notebook 02 says it prints no per-rule placement count.

Where it fits in the kit

The notebooks import these kit modules:

ModuleImported namesNotebooks
recohut_kit.ai_reviewDEFAULT_RULES, classify_all, DEFAULT_DETECTORS, DEFAULT_TARGETS, TargetEntry, map_target, fold_variants, plan_migration, verify_plan, build_handoff, judge_pairing_notes, render_markdown, verify_handoff02 to 07
recohut_kit.function_callingvalidate_arguments05
recohut_kit.harness.contractsToolPolicy05
recohut_kit.providers.codexCodexTextClient07
recohut_kit.providers.codex_authCodexAuth, CodexUnavailable07

Every notebook also imports local support. Notebook 01 imports support and pathlib only. support.default_review() reaches the kit inventory, which the notebook text says ships default patterns for SDK call shapes.

How is this page?

Last updated on