Skip to content

docs: slim AGENTS.md; compact start for small-window models; fix fm tool schemas - #480

Merged
dimetron merged 3 commits into
mainfrom
docs/slim-agents-md
Nov 17, 2026
Merged

dimetron merged 3 commits into
mainfrom
docs/slim-agents-md

Conversation

@dimetron

Copy link
Copy Markdown
Owner

Summary

AGENTS.md: 790 lines down to 130. It is injected into every session, so it now holds only the rules that always apply. Procedures, reasons and history move into five skills under .pi-go/skills/ (git-workflow, pr-workflow, windows-ci, tool-compaction, proof-check). A table in AGENTS.md names which skill to read before which kind of work.

Compact start for small-window models. A model with a context window of 16K or less now starts with a short system prompt (working directory plus a few rules) and only the core tools: read, write, edit, bash, search, find, ls. This applies in both interactive and print mode. Before this, fm could not take even a first turn: the default system prompt measured 18,312 tokens and the tool declarations 8,108, against an 8,192-token window. Against a real fm serve, the compact first turn is about 1,300 tokens.

Project rules loaded once from worktrees. Running from <repo>/.worktrees/<name>, context-file discovery used to load the repository's AGENTS.md twice: once from the worktree and once from the primary checkout above it, possibly from a different branch. A checkout of the same repository above the starting one is now skipped.

fm schema fix (bug on main since #478). The rewrite removed the pattern keyword, which Apple rejects, but it filtered parameter names the same way. So find's and ripgrep's required pattern parameter was deleted, and every find call failed with "pattern is required". The existing test checked that the string "pattern" appeared nowhere in the output, so it passed because of the bug; it now checks the keyword form only and asserts the parameter survives. Objects also gain x-order (required properties first), which fm serve asks for instead of generating properties alphabetically.

Size check. The server's count for the 40 captured tools is 8,016 tokens with or without x-order, so it doesn't tokenize it. pi's estimate counted it as about 600 tokens, so x-order is left out of the estimate.

Testing

  • make build, make vet, make lint (0 issues) and make test all pass.
  • TestFMGuardAgreesWithTheServer passes against a live fm serve.
  • End to end on fm/system: pi --mode print --model fm/system was given the task of fixing a one-line bug (a - b instead of a + b) and running go test.
    • Every request fits in the window.
    • find gets its pattern.
    • "hello" gets a plain reply with no tool calls.
    • The on-device model still fails the task: in 8 runs it never fixed the bug. It usually guesses directories that don't exist (src/, tests/) before listing files. In one run it made the right edit and then overwrote the file with read's output, line numbers included. The changes here make fm usable at all; they don't make the on-device model a good coding agent. Treat it as a smol-role model for short tasks without tools.
  • fm/pcc was not tested. Apple only serves it when fm serve is launched from Terminal.app.

…rules once

A model whose context window is 16K or less (fm, 8K) cannot take the
default start: the system prompt alone measured 18,312 tokens and the tool
declarations 8,108. Such a session now starts on a compact profile - a
short prompt naming the working directory plus the essential tools (read,
write, edit, bash, search, find, ls) - in both interactive and print mode.
Measured against fm serve, the first turn is about 1,300 tokens.

Context-file discovery walking up from a linked worktree under its own
primary checkout (.worktrees/<name>) no longer loads the same repository's
AGENTS.md a second time from the checkout above it.

Signed-off-by: pi <dimetron@me.com>
The fm schema rewrite dropped the 'pattern' keyword, which Apple rejects,
but it filtered property names the same way, so find's and ripgrep's
required 'pattern' parameter was deleted. The model was never offered it
and every find call failed with 'pattern is required'. Property names are
now kept; only their schemas are rewritten.

Each object now carries x-order (required properties first), which fm
serve asks for instead of generating properties alphabetically. The
server does not tokenize it - 8,016 prompt tokens with or without it on
the 40 captured tools - so the size guard leaves it out of its estimate,
which it had overcounted by about 600 tokens.

Signed-off-by: pi <dimetron@me.com>
AGENTS.md is injected into every session, so it now holds only the rules
that always apply (790 -> 130 lines). The reasons, commands and history
behind them move to skills under .pi-go/skills: git-workflow, pr-workflow,
windows-ci, tool-compaction and proof-check, with a table naming which to
read before which kind of work.

Signed-off-by: pi <dimetron@me.com>
@codecov

codecov Bot commented Nov 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.86047% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.49%. Comparing base (8db35a1) to head (b0f70bf).

Files with missing lines Patch % Lines
internal/cli/interactive.go 25.00% 3 Missing ⚠️
internal/cli/cli.go 33.33% 2 Missing ⚠️
internal/agent/agent.go 96.87% 1 Missing ⚠️
internal/provider/fm_tools.go 95.83% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #480      +/-   ##
==========================================
- Coverage   91.50%   91.49%   -0.02%     
==========================================
  Files         394      395       +1     
  Lines       50610    50693      +83     
==========================================
+ Hits        46313    46382      +69     
- Misses       4291     4305      +14     
  Partials        6        6              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dimetron
dimetron merged commit ede50f7 into main Nov 17, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant