kunibert
All repositories: gitoria
5.1 KB
# Mission K3: memory per PR / session resume (kunibert#3)Task (his words, kunibert#1): "basically we want [the consultant] now to build a similar tool with gitoria and hybriel."This step only: Kunibert keeps one model session per PR and, on a wake-up, resumes it with only the delta (the earlier reviewer's memory rules). Local only: no gitoria, no posting, no tickets.## Read first- /media/STORAGE/projects/kunibert/docs/DESIGN.md (sections 3, 7) and reports/K2-runner.md (what exists).- /media/STORAGE/projects/kunibert/docs/reviewer-design/1-design-and-lessons.md ("Memory") and 2-prompts-and-memory.md (RULES and wakePrompt, verbatim).- The existing code: schema.json, tools/runner.hl, lib/runner.hl, lib/review-output.hl, lib/review-prompt.hl. Extend it; keep what works.- /media/STORAGE/projects/hybriel/docs/HL-PRIMER.md, docs/CODE-ORDER.md; plugins/proc/server.hl, plugins/fs as needed.Copy working shapes from the docs. Not covered → DOCS line in the report; a framework gap → GAP line with a minimal repro, no workaround. Hybriel .hl only, no JavaScript/TypeScript.## Hard rule (from Apollo): code never leaves the sandboxEvery codex call, including `codex exec resume`, must carry the `offline` flags in lib/runner.hl (`--ignore-user-config`, web_search disabled, apps/plugins/browser features off, `mcp_servers={}`) and run read-only with stdin /dev/null. Check that resume accepts them; if one is refused, report it and stop, do not drop it.## Build1. **State per PR**: one JSON file per PR under a data dir (e.g. `<data>/<repo-key>/<pr>.json`, written with hl:fs; data dir given as an argument; tests use /media/STORAGE/claude-scratch/kunibert/K3/data). Fields: session id, last reviewed head sha, generation counter, threads (key T<n>, path, line, axis, title, resolved, settled, seen watermark = highest comment id), settled keys, pending notes. Keep it simple; a database comes later.2. **First review**: as today, plus store the session, head, and the findings as threads T1..Tn.3. **Wake-up**: resume the stored session (`codex exec resume --json -c sandbox_mode="read-only" <offline flags> --output-schema <schema> <session> <prompt>`, run in the repo dir, prompt to a file when >16 KB). Prompt = the earlier reviewer's wakePrompt and RULES ported (the earlier reviewer→Kunibert, .reviewer→.kunibert):- delta diff last..head limited to the PR's files (`git diff --name-status -z` merge-base..head, both rename sides) into `.kunibert/delta.diff`; full PR diff stays in `.kunibert/pr.diff`;- "rewritten" when the last head is not an ancestor of the new head;- "no new commits" / "new commits touch none of the PR's files" cases;- thread updates from a local input file (JSON: per thread new comments with id/author/body and resolved flips) standing in for gitoria; only comments above the watermark count;- open thread keys listed; skip the run entirely when nothing is new (same head, no new replies, not forced).Apply replies: resolve:true → thread resolved and settled. New findings → new threads.4. **Generation guard**: a run reads the generation at start; if it changed before the write (reset meanwhile), its writes are dropped.5. **Reset**: `@kunibert reset` = a fresh, unbiased session (as in the earlier reviewer): drop the session id and pending notes, keep the settled keys (they must survive), bump the generation.6. **Lost session** (resume fails because the session is gone): fall back to a fresh session with a one-line ledger of earlier threads.7. CLI: `tools/runner.hl review <data> <repo> <base> <head> [--threads <file>] [--force]` and `tools/runner.hl reset <data> <repo> <pr>`; one JSON line out as before. PR key may simply be the head branch name for now (gitoria will give a number).8. Log `usage` per run in the state file (append), so cost per PR is known.## Proof (real codex runs: at most 3 in total, each costs Sol quota; develop against saved outputs and a fake codex on PATH first, like K2 did)Test repo under /media/STORAGE/claude-scratch/kunibert/K3/ (never a real repo): main; branch `feature` with a planted bug (commit 1).- Run A (real): first review → finding stored as T1.- Commit 2 on `feature` fixes the bug; Run B (real): resume → the reply resolves T1 (resolve:true), no new finding repeating it, verdict approve or comment. Show the prompt that was sent (the delta only).- Without real runs (fake codex or no-op): same head and no new replies → skipped; a merge from main into feature → "touch none of the PR's files"; a force-push rewrite → "rewritten"; a reset during a run → its writes dropped; a missing session → fallback with ledger.- Show that every codex argv (first and resume) contains the offline flags.## Limits- At most 3 real codex runs. About 60 tool calls. No sudo, no new users, no ~/.codex changes, no commits in the kunibert repo, no pushes, no tickets, no messages to others. Scratch only under /media/STORAGE/claude-scratch/kunibert/K3/.- Stop when done or blocked.## Report/media/STORAGE/projects/kunibert/reports/K3-memory.md: files changed, the proof (exact commands, outputs, the wake prompt of run B), DOCS/GAP lines, usage of every real run, open points. Then stop.
Branches
Latest commits
- bd3591c7conductor: gates run on the live day44 binarymre
- 47f747a7records: jukebox #9 fix livemre
- 0a3169fdMerge branch 'vendored-size' into mainKunibert
- e447bb09Vendored size fix: keep renames with an app side whole; type the filter parameter (L10)mre
- 99ccc742Vendored size fix: no renames in the app diff, filter the resumed delta toomre
- 1a52e100|||PR Diff size limit counts only app files when vendored paths are setmre
- 50a1867estatus: jukebox #9mre
- c57484e6log: jukebox #9 diff sizemre
- 795a20carecords: guard fix live (PR 8)mre
- 6981d96fMerge branch 'fresh-on-nocmd' into mainKunibert
- 37c47840runner: one shared prompt for both fresh-session fallbacks (L16)mre
- f945d2e1|||PR runner: a resumed run with no command on a new head gets one fresh session instead of a tool errormre
- 10b2a49estatus: PR 314, guard fix proposedmre
- e73995a3log: hycon PR 314 approved after fresh reviewmre
- f60427falog: hycon PR 314 false tool errormre
- 481974f7log: Hermes accepts PR 259 findingmre
- bb0976acrecords: hycon PR 259 design findingmre
- 5c637c24records: hycon PR 259 false tool errormre
- a344c406log: routger 132 reviewedmre
- 56e70dcbrecords: review time limit 1800 s (routger 132)mre