Files
pi-toolkit/examples/task-mempalace-pi-adapter.json
joakimp f89439e667 feat(pi-task): prototype headless subtask runner with a verified result envelope
`fork` passes the child getHeader()+getBranch() -- the whole untrimmed parent
branch -- so in a long session it continues the parent's narrative instead of
doing the task (4/4 dispatches on 2026-09-06 ignored their brief; one filed a
diary entry as the parent). Upstream considers that by design.

bin/pi-task inverts the defaults: context is an explicit, default-empty JSON
spec; the child is a fresh isolated session with --no-extensions (so the
mempalace bridge, an extension, cannot file anything under our identity); and
the answer must parse as a declared envelope or the task is recorded FAILED
regardless of how fluent the prose was. Adds a post-hoc boundary diff over
roots[], a per-run audit dir, wall-clock kill and post-hoc cost accounting.

`pi-task selftest` feeds the validator 1 known-good + 6 known-bad envelopes and
a two-sided boundary check, and aborts if any pair fails to discriminate.

Measured while building, and documented in the README rather than smoothed over:
  * a fresh session removes the parent's VOICE but not slot-filling -- given a
    self-contradictory spec, a zero-context child invented a task, read the
    README and returned a well-formed envelope nobody asked for. Fresh context
    fixes continuation, not confabulation.
  * read_only is VERIFIED, not enforced: pi has no tool allow/deny list, so
    --no-extensions leaves core read/write/edit/bash in place.
  * a pointer is checked for presence, not checkability ("arithmetic fact" passes).
  * budget.usd is post-hoc; only wall_s is enforced.

Deliberately NOT wired into install.sh: per the 2026-09-06 decision, bake only
after the envelope has been beaten up on real work. First real run is committed
as examples/task-mempalace-pi-adapter.json.
2026-09-07 20:33:02 +02:00

28 lines
2.6 KiB
JSON

{
"id": "mempalace-pi-adapter-feasibility",
"goal": "Determine what it would take to add a 'pi' runner adapter to mempalace's `task launch`, which today supports only codex and claude. Read the adapter contract from the installed source and report the concrete interface a 'pi' adapter must satisfy, what pi can already provide, and what is missing or awkward.",
"deliverable": "1) The adapter contract, stated as the exact tuple/callable shape _TASK_RUNNER_ADAPTERS maps to, with file:line for each element. 2) Every call site that consumes an adapter, with file:line and what it expects. 3) A per-requirement table: requirement -> which pi flag/output field satisfies it -> or GAP if nothing does. 4) An honest LOC estimate for a 'pi' adapter, with the reasoning. 5) The single biggest risk of doing it. Do NOT write any code.",
"effort": "balanced",
"read_only": true,
"roots": ["/workspace/pi-toolkit", "/workspace/mempalace-toolkit"],
"context": {
"facts": [
"mempalace 3.9.0 is installed; its CLI source is /opt/uv-tools/mempalace/lib/python3.13/site-packages/mempalace/cli.py (4081 lines).",
"_TASK_RUNNER_ADAPTERS is DEFINED at cli.py:2198 and CONSUMED at cli.py:2312, cli.py:2316 and cli.py:3937. You do not need to search for it.",
"There is an explicit 'adapter requires runner semantics not implemented yet' exception near cli.py:1090.",
"The host runs pi 0.85.1. Verified available flags: -p/--print, --mode json|rpc, --session-id, --session-dir, --no-session, --fork <path|id>, --no-extensions/-ne, -e <path>, --model, --provider, --thinking.",
"MEASURED pi --mode json output shape: NDJSON, one JSON object per line. Event types seen in order: session, agent_start, turn_start, message_start, message_end, message_update, turn_end, agent_end, agent_settled. The event 'agent_end' carries messages[] where each assistant message has .usage.cost.total, .model, .provider, .stopReason. 'turn_end' carries .message and .toolResults[].",
"Do not trust any claim that pi has a tool allow/deny list: it does not. --no-extensions removes EXTENSIONS only; core read/write/edit/bash always remain."
],
"files": [
"/opt/uv-tools/mempalace/lib/python3.13/site-packages/mempalace/cli.py"
],
"commands": [
"sed -n '2190,2330p' /opt/uv-tools/mempalace/lib/python3.13/site-packages/mempalace/cli.py",
"sed -n '1060,1110p' /opt/uv-tools/mempalace/lib/python3.13/site-packages/mempalace/cli.py",
"grep -n 'runner' /opt/uv-tools/mempalace/lib/python3.13/site-packages/mempalace/cli.py"
]
},
"budget": {"wall_s": 600, "usd": 1.0}
}