pi-fabric-continuity

Continual harness for pi on fabric primitives: provider-owned journal of self-improving notes/principles, exposed as the `continuity` FabricProvider and callable from fabric_exec.

Packages

Package details

extension

Install pi-fabric-continuity from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-fabric-continuity
Package
pi-fabric-continuity
Version
0.5.0
Published
Oct 21, 2026
Downloads
395/mo · 13/wk
Author
e4779
License
ISC
Types
extension
Size
119.1 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-fabric-continuity

npm checks license

Continual harness for pi, built on pi-fabric primitives: self-improving prompt notes, principles, skill descriptions, and sub-agent specs — with a refine loop and no manual import/export of a durable file.

Successor to the pi-continual-harness concept, re-architected per The Harness Playbook: one authority (an append-only journal), state derived by folding, /tree-correct trajectory reads.

How it fits

The roles around the model boundary are deliberately separate:

  • pi-fabric executes and orchestrates; its compaction engine writes the deterministic summary.
  • pi-context-engineer decides what data may cross a single call boundary.
  • pi-vcc preserves the raw lineage that compaction removes.
  • continuity governs the identity boundary: which distilled claims about the operator, the project and the harness itself ride into every system prompt — kept honest by a journaled, evidence-backed self-improvement loop.

Lineage & inspirations

  • The Continual Harness — the four components (prompt / memory / skill / subagent) this package implements.
  • The Harness Playbook — one authority, folding, /tree-correct reads (already linked above; it shaped the architecture).
  • prime-agent — the refine loop: trajectory evidence → proposed deltas → journaled, revertible transitions.
  • ACE (Agentic Context Engineering) — structured, evidence-backed CRUD deltas instead of prose rewrites; the Delta type is ACE-shaped on purpose.
  • pi-vcc — sticky sections and stable-first ordering; our emission order is prompt-cache-stable for the same reason.
  • pi-context-engineer — boundary governance; continuity extends that philosophy to the identity boundary.
  • pi-reflect and pi-mem — surveyed in docs/domain-map.md.

Install

Requires pi >= 1.0 with the pi-fabric extension installed.

pi install npm:pi-fabric-continuity

Or from the repo directly:

pi install git:github.com/e4779/pi-fabric-continuity

Or drop a symlink into ~/.pi/agent/extensions/ for development:

ln -s ~/projects/pi-fabric-continuity ~/.pi/agent/extensions/pi-fabric-continuity

Usage

/refine [lookback] [instructions]
                          # trajectory evidence -> LLM proposer -> journaled deltas;
                          # /refine 50 reviews the last 50 turns. Free text after
                          # the optional number focuses the proposer
                          # (e.g. /refine 100 git discipline)

The single human entry point. Everything else is agent-driven: any fabric_exec program (including spawned durable agents) can ask for and apply curation through the journaled provider — status, list, read, search, history, audit, stats, certify, revert, mutate. tools.call({ ref: "continuity.mutate", args: { deltas: [...] } }) with fabric-side validation, risk policy, and nested-call audit — just ask. (v0.4: the /harness TUI subcommands were removed at the operator's request; /refine was the only command ever used, and provider actions cover the rest with full journal provenance.) continuity.search is the same search as /harness search as a read-risk action: { query, scope?, cwd? } — literal, case-insensitive, no LLM. continuity.stats is the read-risk view behind /harness stats: per-item injection/confirm counters with decay eligibility (attribution = the refine cycle; see the Attribution section). continuity.certify (execute-risk) runs every active item's evidenceCmds fail-closed (non-zero exit or timeout = violated) and appends certify deltas; the fold exposes item.cert = { status, at, digest }, and injected lines gain a freshness tag ([certified 2m ago] / [VIOLATED 3h ago]). It also returns ready-to-publish meshEvents for an optional guest-side mirror: for (const e of out.meshEvents) await mesh.publish(e); — durable note-health events on the continuity.certification topic, visible to sub-agents and peers without loading this plugin.

Auto-refine cadence and refine evidence (opt-in):

// ~/.pi/agent/continuity/config.json
{ "autoRefine": { "enabled": true, "everyTurns": 50 }, "vccEvidence": false,
  "certify": { "timeoutMs": 10000 } }

"vccEvidence": true feeds the refine proposer a bounded, labeled section of vcc_recall output (queries derived from the project directory, ~2k char cap). Requires @monotykamary/pi-vcc; when it is absent or the call fails, refine proceeds unchanged.

The daily loop

Three roles, one journal:

  1. Refine — every N turns (opt-in autoRefine) or on demand (/refine <lookback>), the pipeline reads the recent trajectory and proposes evidence-backed deltas. Repeated patterns, durable facts, and stale items become journal transitions.
  2. The model self-corrects — active items are injected into the system prompt each turn (importance-ordered, token-budgeted). When the model notices an item is wrong or stale mid-session, it updates it directly via continuity.mutate from any fabric_exec program — no waiting for the human.
  3. You curate — by asking the agent ("разбери заметки", "удали протухшее", "проверь факты"); the agent goes through the journaled provider (continuity.list/search/audit/certify/revert). Every mutation is journaled; nothing happens outside the audit trail.

Attribution (v0.5 — honest semantics)

"A note must earn its tokens." Two counters, one loop:

  • injections — exposure: how often the item rode into the system prompt.
  • confirms — the working attribution signal: how often a refine run re-targeted the item (an update/delete in the proposer's batch, or an explicit importance bump citing re-confirmation in the trajectory).
  • Decay is two-sided now: unconfirmed items at the injection threshold drop one importance tier per refine run; the proposer is instructed to bump (+0.05..0.10, cap 0.90) items whose facts prove useful again. Forgetting and re-confirmation balance each other through the same journaled mechanism.
  • The old touches counter (main-model self-report / mutate curation) was removed: models never self-report note usage — the signal measured nothing (verified 2026-10-21: 0 touches across 70 global items, ever). Legacy counters files read tolerantly; the dead field is ignored.

This matches the prime-agent Continual Harness model: attribution is the distillation cycle itself — a fact that keeps shaping trajectories keeps re-appearing in the proposer's evidence.

Scopes: project per working directory (default) and global for cross-project principles. The refine proposer decides per delta (it sees both stores and the scope rules); explicit calls can pin scope per delta or per batch. Global items inject into every project.

Storage

Provider-owned append-only journals, one authority, snapshots derived by folding:

~/.pi/agent/continuity/global/journal.jsonl
~/.pi/agent/continuity/projects/<slug>/journal.jsonl

Scopes: project (default, slug from cwd) and global. Items carry an optional models hint for relevance — never ownership, never blank-slate resets.

Design

Probes (no framework needed):

npm run -s typecheck || npx tsc --noEmit -p tsconfig.json
tsc -p tsconfig.build.json && node tests/journal.probe.mjs && node tests/completions.probe.mjs && node tests/refine.probe.mjs

License

ISC — the OpenBSD-style license.