gitoria

kunibert

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit8d34ca338d34ca33records: repo rename (gitoria#53)mre8d34ca33/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

  • 8d34ca33records: repo rename (gitoria#53)mre
  • 1e05cb3fMerge branch 'repo-rename' into mainKunibert
  • 6ee0d2e9|||PR intake: match a delivery by repo.id and signature, not URLs (gitoria#53 rename)mre
  • 900ffcd4status: routgermre
  • 59b0b793log: routger merge waitmre
  • e52f094alog: routger intake check (hycon#122)mre
  • f979027frecords: design rule livemre
  • 71efaf84Merge branch 'design-guard' into mainKunibert
  • c0656581|||PR Flag removal of a documented design as major unless his recorded yes is linked; rules version 5mre
  • 901cdd75records: L10 update 2 livemre
  • 4a68016bMerge branch 'hl-standard-l10b' into mainKunibert
  • 246d0f30|||PR HL-STANDARD L10 update (hybriel ab293e5a), rules version 4mre
  • 1aa4d64crecords: HL-STANDARD L10 update livemre
  • 2b04c240Merge branch 'hl-standard-l10' into mainKunibert
  • 88c7b09d|||PR HL-STANDARD L10 update (hybriel 5885d688), rules version 3mre
  • 00869ecbrecords: gitoria#50 step 3 livemre
  • f97a0e5fMerge branch 'hl-standard' into mainKunibert
  • 9710e39fType STANDARD as String (L10, Kunibert review)mre
  • 4140b664|||PR Review against HL-STANDARD and cite rule ids (gitoria#50 step 3)mre
  • 75c6888drecords: gitoria#50 step 1 connected and provenmre