- The tracked GitHub/remote product for
D:/quailbot-pishould contain only Quailbot Pi plugin product code. - Internal construction scaffolding such as the RPC bridge, task packets, dummy drivers, import helpers, and other development-only assets live under
.opencode/artifacts/...and remain untracked. - Do not track
scripts/run-pi.mjs,scripts/import-nanonis-workspace.mjs, or other task/instrument-specific helper scripts as product code. - Real imported workspaces may exist locally/gitignored for verification, but product logic must stay workspace/driver/instrument agnostic.
- Mutation gating is domain-generic: the allow/deny control gates mutating tools (
cli_set,cli_ramp,cli_action,click_anchor,set_field) rather than hardcoding a specific instrument, task, or driver name. - Tools are fixed product surface under
src/tools/; workspace data informs prompt/runtime contracts and driver/parameter selection, but does not generate tool names. - Linked-observable forced readback is separate from ordinary tool results: after mutating actions, resolve workspace-declared linked observables, perform readback, and inject/return those observations separately.
quailbot_planwriteandquailbot_plan_and_executeare product tools undersrc/tools/;quailbot_plan_and_executeruns programmatically and sequentially after submission, performs per-step linked-observable readback for mutating steps, and returns one final ordered tool result.
- Start A1 from
ROADMAP. - Before changing the quailbot-pi system prompt, inspect three sources: the current quailbot-pi prompt seam, the original
D:/quailbotprompt, andD:/qdevbot's approach. - Borrow mindset and structure selectively, but do not copy qdevbot or qspmbot scope assumptions about memory, soul, or workspace into quailbot-pi.
- A1 is a full Quailbot system-prompt rewrite, not an append/overlay. The prompt should express Quailbot's identity as a quantum uncertain action-outcome instrument loop agent and should not mention Pi or internal engineering decisions.
- Do not reconstruct generated support sections such as
Available toolsor generic coding/file-editing guidelines inside the rewritten prompt; active tools are model-visible through provider-native tool schemas, and dynamic workspace/plan facts belong in hidden Quailbot context. If support-tool guidance is needed, write Quailbot-owned wording that makes CLI-driver priority explicit. - Use "allowed quantum instrument CLI parameters" wording for WORKSPACE authority. Treat uncertainty as primarily measurement/action-outcome uncertainty: actions such as AWG pulses or STM tip pulses need follow-up measurement/readback to determine what actually happened. Temporary instrument problems are a secondary uncertainty case to diagnose and recover from, not the main Quailbot identity. Omit legacy narration/chain-of-thought constraints.
- Latest correction supersedes earlier overlay guidance: A1 is a full Quailbot system-prompt rewrite, not a Pi append or overlay.
- The final runtime prompt must not mention Pi, a general coding-assistant identity, or internal engineering rationale about why the team chose the design.
- The WORKSPACE authority line should say
allowed quantum instrument CLI parameters. - Frame uncertainty primarily as measurement and action-outcome uncertainty that requires follow-up measurement/readback; temporary instrument trouble is only one subset of the uncertainty model.
- Do not turn transient instrument problems into an immediate stop rule. Quailbot is expected to work through temporary instrument issues instead of immediately reporting failure.
- Do not reintroduce legacy narration-shortness or hidden-reasoning lines from older Quailbot prompts.
- Do not render
BuildSystemPromptOptions.toolSnippetsorpromptGuidelinesinto Quailbot's runtime system prompt; those are construction metadata, not the live tool context.selectedToolsmay be used only as an availability gate for Quailbot-owned guidance, not as wording to copy. - Once the load-bearing A1 prompt decisions are fixed, continue autonomously without additional approval gates.
- Treat dynamically registered tool schemas as the authoritative tool surface.
systemPromptOptions.selectedTools,toolSnippets, andpromptGuidelinesare construction metadata unless they are explicitly rendered into prompt text. - Do not reconstruct generic
Available toolsor SDK-authoredGuidelinessections in the system prompt from those metadata fields. Keep the prompt focused on stable Quailbot identity/policy and Quailbot-owned support-tool boundaries that are not already carried by the real tool schema.
- Keep provider-native tool schemas as the canonical tool surface. Do not copy raw SDK
Available tools,Guidelines,toolSnippets, orpromptGuidelinestext into the runtime system prompt. - If file/shell guidance is still useful, render a Quailbot-authored support-tool boundary section, gated only by tool availability, and word it so CLI driver / WORKSPACE tools remain primary for instrument operations.
- For quailbot-pi identity shifts, rewrite the system prompt instead of appending a small preface to the old Pi prompt.
- The finished prompt should not frame the agent as "Pi";
quailmeansquantum uncertain action-outcome instrument loop. - Describe uncertainty primarily as measurement/readback uncertainty and experiment confirmation, not only transient instrument faults.
- If tool/guideline context is dynamically injected, keep it authoritative; do not hardcode a generic
Available toolsblock when the real tool context already comes from the runtime. - If custom guidance is still needed, keep CLI driver / quantum instrument tools primary and treat generic
read/write/edit/bashguidance as secondary and constrained.
- For Pi TUI acceptance work, interact with the real TUI surface rather than substituting shell or PowerShell automation.
- On this machine, when the user asks for real TUI interaction, use the opened terminal via Windows MCP snapshot/vision instead of bash-driven simulation.
- If the acceptance path is long or context may compact, land the test spec early under
docs/superpowers/specs/before running the live interaction.
- For A5 CLI/tool-result presentation and context-retention design, ground the contract in the actual CLI driver substrate before inventing fields: inspect
D:\quail-cli-core,D:\Nanonis-QCodes-Controller(nqctl), and quailbot-pi's currentcli_*parsing path. Do not assume arbitrary CLI drivers or invent projection fields that the real contract cannot support. - Map
context[0].text, renderResult output, and retaineddetailsonly to information that is actually parsed or preserved by current tool results; treat noisy or unparsable raw stdout as bounded diagnostics, not as semantic fields. - Default
recentFullCliResultCountto2: keep fulldetailsin model-visible context only for the most recent twocli_*tool results; older results should degrade to summary-only context while retaining full local details elsewhere. - For the current quailbot-pi redesign track, use a subagent-driven feature-branch workflow with best-of-N sampling and frequent small commit/push steps.
- A3-era worktree guidance is obsolete. For ordinary feature work in this repo, use normal local feature branches in the main checkout.
- Reserve local
.worktreesfor best-of-N sampling or explicitly authorized isolation only. - Do not leave stale milestone-specific guidance in
AGENTS.md; remove it when it stops being live.
- Do not force an inaccurate Quailbot-owned context bucket breakdown. Pi already exposes aggregate context pressure in the TUI footer, and provider-specific tokenizer/accounting limits make a full per-bucket breakdown false precision unless the data is exact or clearly labeled as an estimate.
- If any
/quailbot-context-style surface is kept, default it to read-only and non-model-visible. - Advisory diagnostics on these surfaces should be warnings only; they must not block tool execution.
- In best-of-N review/judge prompts, bind stable candidate labels (
A/B/C/...) and explicitly tell reviewers to ignore directory, branch, and worktree names. Per-judge path permutations are acceptable only if the candidate labels stay stable. - For multi-task feature branches, per-task spec/code-quality approvals are not enough by themselves. Before handoff, run one final whole-branch review focused on cross-task integration coherence, fail-soft warning paths, lifecycle reload/close semantics, and schema stability.
- For the quailbot-pi memory system, default to domain-organized memory rather than date-organized memory unless the user explicitly changes that direction.
- Split reusable know-how into
skillsand context-specific tuning intomemory: general operational concepts/methods belong in skills, while scenario-specific parameters and empirical effectiveness notes belong in memory. - Skills in this repo should register against workspace CLI driver names. A skill may require multiple CLI drivers.
- If the current workspace does not provide a CLI driver required by a skill, invoking that skill must surface a fixed warning that the required CLI is missing from the current workspace and the user should verify/reset the workspace before relying on the skill.
- For the Pi-agent memory/skill system here, support runtime load/unload control through slash-command-style UX and a simple CLI/TUI menu rather than treating memory activation as fixed at startup.
- Memory retrieval v1 should stay domain-oriented and also expose a search tool.
- The Pi agent itself should be able to create and edit skills, not just consume them.
- The recent full skill-body window defaults to 3 and should be made user-settable from the Pi agent UI/command surface.
- The deployed Pi-agent-owned
AGENTS.mdshould guide memory/skill maintenance in a know-how-oriented rewrite style: update or rewrite the relevant paragraph when new understanding overlaps prior guidance, rather than growing an append-only ledger. - The faithful web calibrator port is A3, not A6. Its canonical tie-breaker is the legacy Python in
D:\quailbot\src\quailbot\calibration\gui.py,cli_import.py, andD:\quailbot\src\quailbot\capture.py. - Treat the TypeScript + web implementation as a 1:1 port of all Python behavior, including behavior not explicitly enumerated in task text. Surface-level UI parity is not sufficient.
Set agent workspace/ activation-request support was explicitly dropped for this port. Treat residual/api/request-activation,pendingWorkspaceActivation, or activation UI as regression residue to remove, not scope to preserve.
- Quailbot Pi state lives at
~/.quailbot-pi/by default, NOT<cwd>/.quailbot-pi/. The cwd-coupled layout was a dev convenience while pi-coding-agent was a local dependency; it is not the product shape. src/workspace/workspace-state.ts:quailbotStateRoot()is the single source of truth. It honorsprocess.env.QUAILBOT_PI_STATE_DIRfirst, then falls back to~/.quailbot-pi/. Thecwdargument is accepted for source-compat but is no longer load-bearing for state location; a future major may remove it.- Do not reintroduce direct
join(cwd, ".quailbot-pi", ...)callsites in production code. UsequailbotStateRoot()(or the per-subsystem helpersmemoryRoot,skillsRoot,experimentLogRoot, etc.) so the override path stays uniform. - Tests must rely on
tests/setup.tsto inject a per-testQUAILBOT_PI_STATE_DIRtmpdir. New tests that assert on state contents should read throughquailbotStateRoot()(or the production helper), not through the test's own cwd. Two exceptions:tests/workspace-ui/server/path-policy.test.tsandtests/workspace-ui/server/file-browser.test.tsconstruct their own fixture state-dirs for security-policy testing -- those stay self-contained. - Workspace JSON files themselves are user-owned and can live anywhere on disk.
settings.jsonstores the absolute path; Quailbot does not copy or relocate user-selected workspace files. The default landing place for editor-created saves is~/.quailbot-pi/workspaces/. - ROI screenshots from
observeandquailbot_plan_and_executewrite into~/.quailbot-pi/experiments/YYYY-MM-DD/exp_*/blobs/images/with the human-readableroi-<name>-<refHash>-<captureId>.pngscheme. Experiments are created only after the first real agent prompt. There is exactly ONE on-disk PNG per ROI capture. The experiment-log image-artifacts pass detects that the source is already insideblobs/images/and records the artifact metadata (size, sha256 for integrity) without copying or renaming. When no experiment is open, captures fall back to~/.quailbot-pi/observations-orphan/. - Only one workspace capture is kept on disk (
workspace-capture.png+workspace-capture.metadata.json); each new capture atomically overwrites. The legacyworkspace-capture.<captureId>.pngversioned snapshots are no longer written, and any leftovers from older versions are cleaned up on each publish. - Agent-visible knowledge tools (
quailbot_memory_*,quailbot_skill_*) take names/domains/topics, never paths. Do not introduce path-shaped parameters for these tools; the user-facing TUI/commands may show absolute paths but the agent's tool surface stays name-only. dependenciesis empty for distribution: Pi core (@earendil-works/pi-coding-agent,@earendil-works/pi-tui,typebox) sit inpeerDependencies: "*"per Pi's package contract. They remain indevDependenciesfor local dev/test/build.- Each ROI capture produces exactly ONE on-disk PNG. ROI tools write directly into
<experimentDir>/blobs/images/roi-<name>-<refhash>-<captureId>.png; the experiment-log image-artifacts pass detects that the source is already insideblobs/images/and records the artifact metadata (size, sha256 for integrity) without copying. Do not re-introduce sha256-named copies, and do not write ROI PNGs at the experiment-root level alongsideevents.jsonl-- both shapes were earlier-iteration duplications that the user rejected.
- After any code change to
src/, runnpm run buildto refreshdist/before exercising the change through Pi. Thepi.extensionsmanifest points at./dist/src/extension.js; without a fresh build, Pi loads stale compiled output and the new behavior will not appear even though source looks correct. - After any code change that produces a new package version (or while validating the published artifact), reinstall the package globally:
npm packto produce the tarball, thenpi install ./quailbot-pi-<version>.tgz(orpi install npm:quailbot-pi@<version>once published). Pi caches installed packages under~/.pi/agent/; without reinstalling, an end-user Pi session will keep loading the previous version. - For local-checkout dev (the
.pi/settings.json: { "packages": [".."] }shape),npm run piandnpm run pi:mutatingchaindev:release(which isnpm run build) automatically. That covers the build step. Reinstall is only needed when moving between local-checkout and installed-tarball validation. - If a test or live session shows behavior matching the prior version, the first thing to check is "did I rebuild?" -- not "is my code wrong?" Stale
dist/is the most common cause of false-negative behavior verification on this project. quailbot-pi的发行态按 home-scoped state 设计:生产态根目录是~/.quailbot-pi/,其中承载workspaces、captures、experiments、settings等用户态数据;当前 repo 内本地 state 只是一段开发期过渡形状。- 开发脚本保持
pi --session-dir .pi-state/sessions;不要把这个 dev-only 会话目录和发行态~/.quailbot-pi/混为一谈。 - Gate B 决策是单一
~/.quailbot-pi/workspaces/作为中心 workspace 存放区;但 workspace editor 的任意 JSON 导入能力、以及/quailbot-workspace load直接加载任意 schema-valid 路径的能力仍然要保留,不能因为中心化存放就把这些入口做死。 - ROI 截图不应继续堆在单独的
.quailbot-pi/roi-observations/;默认只跟随~/.quailbot-pi/experiments/YYYY-MM-DD/exp_*/保存,并沿用人类可读命名,同时仍保留 blob 存储副本。workspace 截图在.quailbot-pi下只保留一张当前图,新图直接覆盖旧图。
- After local code changes, rebuild the package and reinstall the fresh tarball before testing or release work; otherwise the installed
quailbot-pipackage can go stale. - ROI capture artifacts should live only at
experiments/YYYY-MM-DD/exp_*/blobs/images/roi-LiveScan-<refhash>-<id>.png. events.jsonlshould reference ROI images as\\blobs\\images\\roi-LiveScan-<refhash>-<id>.png; do not keep the old\\<sha256>.pngreference shape and do not duplicate ROI image copies.
- A release is not meaningful if it ships only a tag; publish a
.tgz/.gzinstall artifact or clearly point the release to the matching npm package version. - When storage or image-path contracts change, audit README and system-prompt text for stale descriptions before release.
- If docs or the system prompt mention "Where Quailbot state lives", explain the actual state root clearly, distinguish it from legacy
~/.pi, and note thatQUAILBOT_PI_STATE_DIRoverrides the state root.
- Interactive testing substrate: a live Nanonis simulator runs on this machine. Start a test quailbot-pi over RPC using the project's previously recorded method to drive real interactive tests against it.
- The workspace-editor web UI is verified with Playwright only (not Chrome DevTools / browser-MCP tools).
- Experiment lifecycle is lazy and session-scoped: do NOT create an experiment at Pi startup / session_start. Open it on the first real (non-slash-command) user prompt. A resumed session reuses the same experiment (session index keyed by Pi session id). Experiment paths are flat
experiments/YYYY-MM-DD/exp_*, never nestedYYYY/MM/DD. - Workspace safety is enforced, not decorative: parameter min/max/slew act as hard gates on mutating tools (cli_set / cli_ramp / plan_and_execute) before the instrument is touched, and the editor's allow get/set/ramp checkboxes are real, user-editable capability toggles.