Files
magpie/internal/gateway/testdata/context
yetone 71718b277a prompt: Pi's <available_skills> and its context files count as skills and memory, not system prompt
Reported on X by @JinJieBeWater: Pi's skills showed up as system prompt
in the context breakdown. Pi (pi-coding-agent 0.73.1, read from the npm
tarball: formatSkillsForPrompt in dist/core/skills.js, buildSystemPrompt
in dist/core/system-prompt.js) builds one system prompt: its own text,
then "# Project Context" with each AGENTS.md/CLAUDE.md under
"## <path>", then a paragraph on loading skills ("The following skills
provide specialized instructions for specific tasks. ...") and an
<available_skills> block of <skill> entries (the Agent Skills standard's
format), then "Current date:" and "Current working directory:" lines.
splitSkills knew only Claude Code's "The following skills are available
for use with the Skill tool:" list, systemText only a leading
<skills_instructions> (Codex), and splitMemory only Claude Code's,
OpenCode's and Codex's headings, so all of Pi's prompt was one System
prompt item.

- splitSkills also takes an <available_skills> block out, with Pi's
  lead paragraph before it, on every protocol and in a reminder too.
  The tag must open a line and the block must close, so prose naming
  the tag stays put. Any agent listing skills in the standard's block
  is read the same way.
- splitMemory reads Pi's "## /path/AGENTS.md" files as memory, only
  under Pi's "# Project Context" header, and ends the last one at Pi's
  skills or its closing lines. A file under ~/.pi/ is the user's.

Prompts recorded before keep only token counts per item, so they stay
as they were; new requests are split.

testdata/context/pi-0.73.1-system.txt is Pi's default system prompt
assembled by hand from 0.73.1's source (not run): its tool snippets and
guidelines, two context files and two skills, one description with
Pi's &amp; escaping.

Run on mote at this tree (rebased on e4e9eb092):
- go test ./internal/gateway -count=1 -timeout 45m: every test ok except
  TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes, red 3 of 3 on
  e4e9eb092 without this change too (#7117, open)
- go vet ./internal/gateway, also GOOS=linux and GOOS=windows: ok
- gofmt -l: clean
Then rebased onto d7796bf40 (three commits in netproxy, usage, usageapi
and gui, none in internal/gateway); at that pushed tree go vet
./internal/gateway and -run 'Prompt|SplitSkills|SkillsApart': ok.
Broken by hand: with e4e9eb092's prompt.go, TestPromptOfPiSkills is red
("the system prompt keeps the skills"); with the splitMemory branch
turned off, TestPromptOfPiMemory is red (no memory item).
Not tried: a real Pi run through magpie; only Pi's source was read.
No GUI change (the Context view shows the parts it is given), so no GUI
suite.
2026-11-19 18:40:18 +08:00
..