Skip to content

Add ipyai backend: split templates into a per-host bootstrap plus the shared dojo round - #22

Open
ncoop57 wants to merge 4 commits into
mainfrom
ipyaidojo
Open

Add ipyai backend: split templates into a per-host bootstrap plus the shared dojo round#22
ncoop57 wants to merge 4 commits into
mainfrom
ipyaidojo

Conversation

@ncoop57

@ncoop57 ncoop57 commented Aug 21, 2026

Copy link
Copy Markdown

What

Adds ipyaidojo, an ipyai backend for llmdojo, and restructures the template so a host's bootstrap and the worked dojo round are captured and stored separately.

Why

ipyai sessions are aidialog dialogs whose model context is rebuilt from the dialog each turn, so the dialog is the store — but its tool is py (not clikernel's execute) and it has no clik skill to document. The bootstrap therefore has to be per host, while the round can be captured once and shared by every backend.

Changes

  • Two-prompt templates: BOOT_PROMPT (the host's startup doc reads) then TMPL_PROMPT (the round). assemble/split_template join and separate them; capture_slice now returns (boot, start, last) and boot_gates validates a bootstrap reply.
  • Packaged dialogs: dojo_template.ipynb becomes dojo_round.ipynb (shared) plus clik_boot.ipynb (Claude/Codex) and ipyai_boot.ipynb (ipyai).
  • llmdojo/ipyaidojo.py: replays cells through ipyai's kernel client (no model spend), writes the store, and prep_dojo writes a session under ./.ipyai/sessions/ for ipyai -r. capture_boot (ipyaidojo --capture) captures ipyai's bootstrap from a live session, replaying for untruncated results.
  • ipyai/startup.py + README: imports, doc aliases, and the session rules applied to the model's cells only (store_history=False); doc-state keys on the session stem via LLMDOJO_HOST_ID, now read live in rules.py.
  • Capture children: Claude and Codex now play the bootstrap prompt, then resume for the dojo prompt; each writes boot.ipynb and round.ipynb beside its store for review.
  • dojobuild: refreshes the packaged clikernel dialogs and builds all three stores; --claude/--codex/--ipyai build one each. (--ipyai needs ipyai installed and a running rustygate.)
  • strip_dojo (both backends) also drops a bootstrap turn immediately preceding a dealt round.
  • Docs updated: README.md, DEV.md, ipyai/README.md, dojo_data/capture_prompt.md.

- `nbs/03_ipyaidojo.ipynb` -> `llmdojo/ipyaidojo.py`: ipyai sessions are aidialog dialogs with context rebuilt from the dialog each turn, so the store is the canonical dialog replayed through ipyai's `py` (calls renamed, results regenerated, no model spend). `build_template` writes `dojo_data/ipyai_store/`; `prep_dojo` writes the round as an ipyai session and `ipyaidojo` launches `ipyai -r` on it.
- `ipyai/startup.py` + README: the ipyai twin of `claude/` (imports and doc aliases, no `clik`, no banner), symlinked into ~/.config/ipyai/.
- ipyai's round opens with `doc(pysk, edsk)`: `capture_slice` accepts a host-less bootstrap cell, and the card no longer names `clik` as required reading.
- `dojobuild --ipyai`; all three stores rebuilt (card text changed).
…state keys on the session

- `ipyai/startup.py` installs `make_inspector()` through IPython's pre_run_cell event and an AST transformer, gated to cells with `store_history=False` (ipyai's marker for the model's `py` cells); the user's typed cells are never inspected. Notes reach the model inside the tool result; a blocking rule rejects the cell.
- `_host_session` honours an explicit `LLMDOJO_HOST_ID` (read live), so a host that learns its conversation id after kernel start (ipyai: the session file) can name it; `prep_dojo` seeds the baked round's doc-state under that key.
- `03_ipyaidojo.ipynb`: a "Rules in ipyai kernels" lesson (the model's `!echo hi` is rejected, the user's runs); docs updated.
@ncoop57 ncoop57 changed the title Add the ipyai backend; split the template into a per-host bootstrap and a shared round Add ipyai backend: split templates into a per-host bootstrap plus the shared dojo round Aug 21, 2026
@ncoop57 ncoop57 added the enhancement New feature or request label Aug 21, 2026
@ncoop57
ncoop57 marked this pull request as ready for review August 21, 2026 20:58
@ncoop57
ncoop57 requested a review from jph00 August 21, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant