gitoria

kunibert

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit2eee9dbb2eee9dbbMerge branch 'revendor-day44' into mainKunibert2eee9dbb/missions/K3-memory.md

5.1 KB

  1. # Mission K3: memory per PR / session resume (kunibert#3)
  2. Task (his words, kunibert#1): "basically we want [the consultant] now to build a similar tool with gitoria and hybriel."
  3. 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.
  4. ## Read first
  5. - /media/STORAGE/projects/kunibert/docs/DESIGN.md (sections 3, 7) and reports/K2-runner.md (what exists).
  6. - /media/STORAGE/projects/kunibert/docs/reviewer-design/1-design-and-lessons.md ("Memory") and 2-prompts-and-memory.md (RULES and wakePrompt, verbatim).
  7. - The existing code: schema.json, tools/runner.hl, lib/runner.hl, lib/review-output.hl, lib/review-prompt.hl. Extend it; keep what works.
  8. - /media/STORAGE/projects/hybriel/docs/HL-PRIMER.md, docs/CODE-ORDER.md; plugins/proc/server.hl, plugins/fs as needed.
  9. 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.
  10. ## Hard rule (from Apollo): code never leaves the sandbox
  11. Every 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.
  12. ## Build
  13. 1. **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.
  14. 2. **First review**: as today, plus store the session, head, and the findings as threads T1..Tn.
  15. 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):
  16. - 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`;
  17. - "rewritten" when the last head is not an ancestor of the new head;
  18. - "no new commits" / "new commits touch none of the PR's files" cases;
  19. - 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;
  20. - open thread keys listed; skip the run entirely when nothing is new (same head, no new replies, not forced).
  21. Apply replies: resolve:true → thread resolved and settled. New findings → new threads.
  22. 4. **Generation guard**: a run reads the generation at start; if it changed before the write (reset meanwhile), its writes are dropped.
  23. 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.
  24. 6. **Lost session** (resume fails because the session is gone): fall back to a fresh session with a one-line ledger of earlier threads.
  25. 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).
  26. 8. Log `usage` per run in the state file (append), so cost per PR is known.
  27. ## 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)
  28. Test repo under /media/STORAGE/claude-scratch/kunibert/K3/ (never a real repo): main; branch `feature` with a planted bug (commit 1).
  29. - Run A (real): first review → finding stored as T1.
  30. - 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).
  31. - 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.
  32. - Show that every codex argv (first and resume) contains the offline flags.
  33. ## Limits
  34. - 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/.
  35. - Stop when done or blocked.
  36. ## Report
  37. /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

  • 2eee9dbbMerge branch 'revendor-day44' into mainKunibert
  • e96721cb|||PR Re-vendor plugins from Hybriel day44 (hl:fetch redirect fix)mre
  • 0c67ab8cLog: kunibert repo ping provenmre
  • b6f3039cLog: kunibert repo connectedmre
  • b143c3c7CONDUCTOR: push recipemre
  • 7a1279eeRule: conductor merges own utility PRs after green reviewmre
  • 4038b3e0Log: kunibert#18 openedmre
  • 18543db1Log: day42 fetch fix, re-vendor pendingmre
  • 81a12f96Statusmre
  • 6ce706abRecords: neutral wording, split cleanupmre
  • 81a4d31bDocs: neutral wordingKunibert
  • 8205b05eRecords: #17 livemre
  • c3391204Answer fresh reviews under open threadsKunibert
  • a0f3d147Records: #16 livemre
  • 04322148Run reviews in parallel across repositoriesKunibert
  • a6577aaeRecords: #14 live, #16 startedmre
  • 0382238bStart fresh on Review again and name vendored pathsKunibert
  • 5608c6f1Records: kunibert#13 vendored paths livemre
  • 8840771dExclude vendored findings from app verdictsKunibert
  • 6aa65353Records: jukebox connected, first reviewmre