omp packages

vcc-hybrid0.1.1

Compaction for Pi that keeps a rewritten state index next to the pi-vcc summary

choam2426 Published 3 days ago MIT ~0 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

vcc-hybrid

한국어

A method for compacting agent conversations: it adds a model-written state index to a rule-based summary. This repository contains the method's benchmark results and a Pi extension for trying it.

Why

When a conversation outgrows the context window, the agent shortens older messages to make room. This is compaction. Claude Code, Codex and Pi have a model write a summary by default. The summary reads well, but details it leaves out are hard to get back.

VCC uses rules to organize conversation logs and lets the agent look up the original messages. Inspired by that approach, pi-vcc builds a summary without a model call. If the summary leaves out an answer, though, the agent has to recognize that it needs to look. On CompactBench Practice, default pi-vcc answered “not stated” 2,575 times when the answer was in the conversation. Of those, 2,234 came from question batches in which the agent never consulted the source.

Even when the agent searches, which messages it finds matters. A search for the release date might turn up the original Friday plan but miss the message postponing it to Monday. The agent could then give an outdated answer despite having checked the source. vcc-hybrid records the current decision alongside the summary, with a reference to the message that supports it. The agent can answer from that record or go straight to the decision without having to find it again by search.

The state index

vcc-hybrid keeps the rule-based summary and adds a state index next to it. The index is a list with one line per topic: the current state and the number of the source message it is based on. At each compaction a model reads the previous index and the messages being compacted, and rewrites the whole index.

Say the team first planned a Friday release, then postponed it to Monday in message 412. The index would read:

Release date — moved to Monday; Friday plan cancelled (#412)

Asked "When is the release?" after compaction, the model can answer from this line. If it needs more detail, it opens message 412.

Model summary
(Claude Code, Codex, Pi default)
Rule-based summary
(pi-vcc)
Rule-based summary + state index
(vcc-hybrid)
How the summary is made A model writes it Extracted by rule Summary extracted by rule; index written by a model
Model call at compaction Yes No Yes, to write the index
What holds now Up to the summarizing model Not marked One line per topic
Compacted messages Replaced by the summary Searchable Searchable, or opened by the number in the index

How it works

The state index records the new Monday release date. Message 412 gives the original wording.

  1. Older messages are summarized by rule, without a model call. Recent conversation is left uncompacted.
  2. A model reads the previous index and the messages compacted this time, and rewrites the whole index with a budget of 32,000 characters (about 8K tokens).
  3. When answering, the model sees the rule-based summary, the index and the recent conversation. If a missing detail could change the answer, it opens a cited message or searches the source.

See the method for details.

Results

All measurements were made in Pi, against Pi's default summary and pi-vcc. We did not compare with Claude Code's or Codex's compaction. The three benchmarks measure different things; their scores should not be combined. See the evaluation design.

CompactBench Practice

Each of 48 conversations was compacted at the end of each round, then tested on earlier details. We ran each condition three times with DeepSeek V4.1 Flash at low effort. At first compaction the conversations were only about 26–29K tokens long, so most of the conversation stayed uncompacted at default settings.

Average score, vcc_recall calls and estimated cost for Pi, pi-vcc and vcc-hybrid, with default settings and with everything compacted.

Setting Arm Run 1 Run 2 Run 3 Mean /100 Recall calls Compaction cost Answer cost
Default Pi 87.36 86.58 86.69 86.88 0 $1.39 $3.75
Default pi-vcc 72.01 72.11 74.03 72.72 2,819 $0 $14.54
Default vcc-hybrid 93.75 93.94 93.86 93.85 953 $2.17 $8.83
Everything compacted Pi summary only 77.66 78.95 76.82 77.81 0 $1.52 $0.84
Everything compacted pi-vcc 90.64 90.20 91.02 90.62 36,041 $0 $33.28
Everything compacted Index only 90.64 89.63 88.70 89.66 1,881 ($1.84) $1.95
Everything compacted vcc-hybrid 92.00 90.40 89.84 90.75 2,285 $1.84 $2.85

Recall calls and estimated costs are per 48-conversation run, averaged over the three runs at common off-peak prices. The parenthesized $1.84 is the cost of building the reused index, not a new charge for the index-only arm.

The hybrid had the highest mean score at default settings. With everything compacted, it scored just 0.13 points above pi-vcc but made about 1/16 as many recalls at about 1/7 of the combined compaction and answer cost. Analysis by condition and source data

Code repair after compaction

Each arm resumed 22 unfinished repairs nine times per task with GPT-6.1 Terra at medium effort. Each metric uses six resumes per task (132 per arm); the eight-work-response checkpoint and final outcomes use different combinations of runs. This tests a single compaction before resuming, not repeated compaction during a long task.

Pass rate within eight work responses and cost per resume for full history, Pi summary, pi-vcc and vcc-hybrid.

Arm Pass within 8 work responses Final pass Responses/resume Recalls/resume Est. cost/resume
Full history (uncompacted) 118/132 (89%) 124/132 (94%) 7.8 0 $0.026
Pi summary 100/132 (76%) 123/132 (93%) 10.7 0 $0.031
pi-vcc 104/132 (79%) 121/132 (92%) 11.3 1.2 $0.027
vcc-hybrid 112/132 (85%) 121/132 (92%) 9.2 0.4 $0.032

The hybrid passed 85% of resumes within the official eight-work-response limit, but its pass-rate comparisons with Pi summary and pi-vcc did not meet the corrected significance threshold. Without a response limit, it finished in fewer responses on average than either of the other compacted arms. Per-task results and paired tests

BEAM 1M

Each arm ran all 35 million-token conversations once with GPT-6.1 Terra at medium effort. Each conversation was compacted ten times before the agent answered 20 questions.

Overall score, recall, compaction cost and time, answer cost per question, and score by question type for Pi, pi-vcc and vcc-hybrid on BEAM 1M.

Arm Overall score Recalls/question Input tokens in first answer request after compaction
Pi default 0.436 0 25,245
pi-vcc 0.498 3.18 26,071
vcc-hybrid 0.540 1.24 33,750
Arm Est. cost/compaction Time/compaction Est. answer cost/question Answer time/question
Pi default $0.125 72 s $0.0100 5.8 s
pi-vcc $0 0.08 s $0.0143 14.3 s
vcc-hybrid $0.150 118 s $0.0169 9.8 s

The hybrid outscored Pi default on 31 of 35 conversations. It outscored pi-vcc on 22, which did not meet the sign-test threshold. Compaction took longer than with pi-vcc, but the hybrid made fewer recalls and averaged 9.8 rather than 14.3 seconds per answer. Category scores and paired comparisons

Try it in Pi

The method is available as a Pi extension. If pi-vcc is installed, remove it first. With both installed, the extension warns at startup.

pi install npm:vcc-hybrid
  • Automatic compaction and /compact write a summary and state index. /compact keep:N leaves the last N user turns uncompacted; for example, /compact keep:2 leaves two.
  • Text after /compact, such as /compact focus on the deployment constraints, tells the writer what to emphasize in the index.
  • /vcc-hybrid state shows the index. /vcc-hybrid recall <query> searches compacted messages; the model uses vcc_hybrid_recall.

The writer uses the current session's model and thinking level unless you override them in global or project settings.json:

{
  "vccHybrid": {
    "model": "openai/gpt-6.1-terra",
    "thinking": "low"
  }
}

If the configured writer cannot finish, the extension switches once to the current session model and thinking level. The session model receives the current index and the unfinished messages, so the provider and cost can change. The compaction notice shows the model and reason for the switch.

The amount of recent conversation left uncompacted scales with Pi's compaction.keepRecentTokens, including model-specific settings. Index writing runs during compaction, not in the background. See one compaction, failure handling and trade-offs.

Check locally

mise install
mise exec -- npm ci --ignore-scripts
mise exec -- npm run typecheck
mise exec -- npm test
mise exec -- npm run pi:vanilla -- --version
mise exec -- npm run pi:vcc -- --version
mise exec -- npm run bench:practice -- --dry-run

Both version checks use Pi 1.6.0 from the lockfile. pi:vanilla loads no extension; pi:vcc loads only @sting8k/pi-vcc 0.12.0. The bench adapter connects the hybrid to the Pi runner. The dry run checks the compaction, recall and grading path on one case with a mock model. It downloads data and scorer dependencies on first use but makes no paid model calls. Mock scores are not performance results. Verification details distinguish unit tests, session replay and real-model tests.

License

The code is MIT. extension/vcc/ derives from pi-vcc by sting8k and retains its MIT notice. CompactBench Practice data are Apache-2.0. BEAM result data are CC BY-SA 4.0. Code repair results use Compact-Bench; its own contributions are Apache-2.0 and upstream material retains its own terms.

Acknowledgments and references