Goal
Implement the useful parts of Pi Agent in langbot-local-agent while preserving LangBot's architecture:
- LangBot Host owns authorization, resources, transcript/history, artifacts, state/storage, and platform delivery.
- Local Agent Runner owns model-facing behavior: message/context assembly, tool loop policy, context budgeting, and recovery strategy.
- The runner must use
AgentRunAPIProxy and ctx.resources; it must not reach into host-private managers or assume Pi's local filesystem/security model.
- Pipeline remains a compatibility adapter, not the design center.
Source References
Non-goals
- Do not copy Pi CLI/TUI product behavior wholesale.
- Do not add per-conversation mutable state to the plugin instance.
- Do not bypass Host authorization to access local files, tools, models, knowledge bases, or storage.
- Do not commit dependency files (
pyproject.toml, uv.lock) unless a dependency change is explicitly intended.
Implementation Checklist
Phase 0: Guardrails and Baseline
Phase 1: Pi-style Tool Loop
Phase 2: Tool Result Bounding
Phase 3: Per-turn Context Budgeting
Phase 4: Context Overflow Recovery
Phase 5: LLM Summary / Checkpoint Path
Phase 6: LangBot QA Gates
Current Sprint Slice
Acceptance Notes
A feature is not done merely because the issue body says it is covered. Mark items complete only when source code, focused tests, and at least the relevant LangBot browser smoke path agree.
Goal
Implement the useful parts of Pi Agent in
langbot-local-agentwhile preserving LangBot's architecture:AgentRunAPIProxyandctx.resources; it must not reach into host-private managers or assume Pi's local filesystem/security model.Source References
pi/packages/agent/src/agent-loop.tspi/packages/agent/src/agent.ts,pi/packages/agent/src/types.tspi/packages/coding-agent/src/core/agent-session.tspi/packages/coding-agent/src/core/compaction/*Non-goals
pyproject.toml,uv.lock) unless a dependency change is explicitly intended.Implementation Checklist
Phase 0: Guardrails and Baseline
prompt_get/ effective prompt direction if present in the active branch.skill_authoring/skill_injectioncapabilities if present in the active branch.AgentRunAPIProxy.Phase 1: Pi-style Tool Loop
tool.call.completedas each tool finishes;max-tool-iterationsloop guard.Phase 2: Tool Result Bounding
max-tool-result-chars/ equivalent runner config.Phase 3: Per-turn Context Budgeting
Phase 4: Context Overflow Recovery
runner.context_overflowfailure code after the one retry.Phase 5: LLM Summary / Checkpoint Path
Phase 6: LangBot QA Gates
langbot-local-agentpass.local-agent-basic-debug-chatpasses.local-agent-plugin-tool-call-debug-chatpasses.langbot-skillswhen the fixture supports it.Current Sprint Slice
Acceptance Notes
A feature is not done merely because the issue body says it is covered. Mark items complete only when source code, focused tests, and at least the relevant LangBot browser smoke path agree.