Configure Pi, and report when the embedded command catalog is stale - #80
Merged
Merged
Conversation
Pi keeps its project resources under .pi/, and exports PI_* variables into every command it runs. Detecting both means running `cratis init` from inside a Pi session configures Pi even on a project that has nothing yet - the same first-run behaviour Claude Code already gets. PI_CODING_AGENT identifies the harness itself, where PI_SESSION_ID only says a session is in flight, so both are accepted and the former stays the signal.
Pi discovers skills from .pi/skills/<name>/SKILL.md and prompts from .pi/prompts, and reads its context from AGENTS.md. The generated skill already carries the name/description frontmatter Pi requires - the same shape Copilot uses - so it is written unchanged and only the path differs. AGENTS.md rather than a Pi-specific file because that is what Pi reads and it is the cross-tool convention: a project already carrying one gets the reference appended rather than a second file to keep in sync. Appending is idempotent, since AGENTS.md is usually hand-maintained. --refresh now updates the Pi skill too, or an upgrade would leave it behind while refreshing the others.
The catalog embedded in CHRONICLE.md and the generated skill is a snapshot taken when init ran, not a live lookup. After upgrading the CLI it keeps describing the older surface: commands added since are invisible to an agent, and ones renamed or removed are still advertised. Nothing said so, so the failure was silent - an agent confidently calls a command that is gone. Init already skips an existing CHRONICLE.md, which is right since it may have been edited. It now reads the version out of it first and, when that differs from the running CLI, says so and names --refresh instead of reporting a bare "already exists". A file carrying no version is deliberately not reported as stale: it predates stamping or was hand written, and a warning nobody can act on is how people learn to ignore warnings.
--tool now accepts pi, so its help has to say so or the option is undiscoverable. The docs also stated the catalog was refreshable without saying why anyone would need to, which is the part that matters.
woksin
force-pushed
the
feat/79-configure-pi-and-detect-stale-context
branch
from
August 19, 2026 12:33
61bcb6d to
bf1c32b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added
cratis initnow configures Pi, writing the Chronicle skill to.pi/skills/chronicle-cli/SKILL.md, the diagnose prompt to.pi/prompts/, and the@CHRONICLE.mdreference toAGENTS.md. Pi is detected from a project's.pi/directory and from thePI_*variables it exports, so runningcratis initinside a Pi session configures it even on a project that has nothing yet.--tool pitargets it explicitly. (cratis init does not configure Pi, and the embedded llm-context is a pinned snapshot #79)Changed
cratis initnow reports whenCHRONICLE.mdwas generated by a different version of the CLI, and namescratis init --refreshas the fix. The embedded command catalog is a snapshot rather than a live lookup, so after an upgrade it kept describing the surface it was generated from — commands added since were invisible to an agent, and ones renamed or removed were still advertised, with nothing saying so. (cratis init does not configure Pi, and the embedded llm-context is a pinned snapshot #79)cratis init --refreshnow also updates the Pi skill, alongside the Claude and Copilot ones. (cratis init does not configure Pi, and the embedded llm-context is a pinned snapshot #79)