Pi Agent Platform
v1.2.17 docs · EN Commands

Less context without reducing model quality

Local indexing, ranked retrieval, task-driven tool loading, semantic compaction, and transparent telemetry for Agent Watch.

Task-driven tools

Pi includes governance, policy, retrieval, knowledge, onboarding, or usage guidance in the prompt only when the task needs it. The runtime guard remains active in the background.

Local index

FTS5, symbols, and the import graph live under .pi/piagent-state/context-engine/. Storage is restricted to the current OS account; policy changes retry FTS rebuild and VACUUM until purging completes.

Ranked context

Explicit paths, lexical matches, symbols, Git signals, test relationships, positive feedback, and graph rank are combined before packing into a hard token budget.

Semantic compaction

Preserves the goal, decisions, changed files, verification, and blockers. Removes repeated logs, source excerpts, and superseded plans.

Test impact

Walks the import graph backward from changed files to suggest dependents and focused tests before running the full suite.

Agent Watch

Local events include session, model, thinking, tool surface, retrieval confidence, context-use ratio, and waste metrics without storing raw prompts or outputs a second time.

The index contains source bodies

Protected paths and secret files are excluded. The directory uses mode 0700; database, WAL, and SHM files use 0600. Normal refresh uses SQLite core and FTS5 secure delete. Full FTS rebuild and VACUUM run only when exclusion policy changes or an interrupted purge must resume, not on every prompt or refresh.

Inside Pi
/context index
/context rebuild
/context pack Fix invoice calculation
/context impact
/usage efficiency
From a terminal
piagent-context rebuild
piagent-context pack "Fix invoice calculation" --tokens 4000
piagent-context efficiency