Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
86c03af
test: add compaction benchmark harness
BadLiveware Apr 27, 2026
b06cce8
fix: preserve compaction evidence handles
BadLiveware Apr 27, 2026
f87c79d
test: simulate full-prompt cache churn
BadLiveware Apr 27, 2026
d2bc8ea
fix: keep blocker updates out of goals
BadLiveware Apr 27, 2026
d54e927
test: report section-level cache churn
BadLiveware Apr 27, 2026
5018263
test: support real session benchmark replay
BadLiveware Apr 27, 2026
3fe31ac
test: diagnose real-session cache churn
BadLiveware Apr 27, 2026
53dc551
test: add cache-stability assertions
BadLiveware Apr 27, 2026
d0a9962
fix: split scope updates from stable goals
BadLiveware Apr 27, 2026
40aa00b
fix: keep merged goals cache-stable
BadLiveware Apr 27, 2026
039b522
fix: ignore preference-like error text
BadLiveware Apr 27, 2026
8398694
fix: filter pasted config from scope
BadLiveware Apr 27, 2026
7442eb7
test: compare compaction across refs
BadLiveware Apr 27, 2026
ab8a758
test: expose production compaction layers
BadLiveware Apr 27, 2026
c915e83
refactor: model compaction state explicitly
BadLiveware Apr 27, 2026
1474094
refactor: render merged summaries from state
BadLiveware Apr 27, 2026
03fb1d2
refactor: render stable sections before scope
BadLiveware Apr 27, 2026
0e8e7bf
test: add evidence growth cache probe
BadLiveware Apr 27, 2026
3b0afe3
fix: normalize evidence path handles
BadLiveware Apr 27, 2026
ea27f19
refactor: keep prior evidence handles stable
BadLiveware Apr 27, 2026
fc26cea
refactor: keep prior preferences stable
BadLiveware Apr 27, 2026
e2016cf
refactor: keep prior scope stable
BadLiveware Apr 27, 2026
7c26f1d
test: enforce cache boundary probes
BadLiveware Apr 27, 2026
03df01e
test: cap mutable recent sections
BadLiveware Apr 27, 2026
438f545
test: report compaction comparison outliers
BadLiveware Apr 28, 2026
2548dfe
docs: add compaction north star guidance
BadLiveware Apr 28, 2026
0d6288c
feat: add pi-vcc compaction report card
BadLiveware Apr 28, 2026
acaf4cc
feat: expose compaction report deep dives
BadLiveware Apr 28, 2026
a8afd85
fix: isolate commit and evidence cache churn
BadLiveware Apr 28, 2026
f36b837
fix: bound verbose recent mutable entries
BadLiveware Apr 28, 2026
86dac37
prototype: add model-reference compactor benchmark
BadLiveware May 3, 2026
d2b9f3b
feat: add context dump command for test data extraction
BadLiveware May 3, 2026
37cf9b3
feat: add real LLM classifier and actionable REF/goal-bundle design
BadLiveware May 3, 2026
3c5ce1f
feat: add actionable REF, goal bundles, and acronym expansion to clas…
BadLiveware May 3, 2026
ce2c82a
fix: enforce KEEP cap and add few-shot examples to classifier prompt
BadLiveware May 3, 2026
8364dd7
refactor: replace chunk-count cap with immediate-utility principle
BadLiveware May 3, 2026
0d56b1c
feat: add SUBGOALS hierarchy replacing flat goal chunks
BadLiveware May 3, 2026
09245f3
feat: add real context buffer for /pi-vcc-dump-context
BadLiveware May 3, 2026
53247f7
feat: add --raw-context mode to dump real Pi context
BadLiveware May 3, 2026
3287ffa
fix: per-session context buffers to prevent cross-session overwrites
BadLiveware May 3, 2026
586b740
feat: inline small REF entries instead of forcing recall
BadLiveware May 3, 2026
edd5b73
refactor: tiered inlining thresholds by chunk kind
BadLiveware May 3, 2026
6373ed2
test: add multi-cycle REF-to-KEEP promotion case
BadLiveware May 3, 2026
8b78f21
test: add cost tracking to classifier, fix gold assertions for MRC
BadLiveware May 3, 2026
fb009d9
feat: add model-reference compaction strategy for Pi integration
BadLiveware May 3, 2026
9499b7e
feat: auto-read DeepSeek API key from Pi auth storage
BadLiveware May 3, 2026
31fb560
feat: add per-session strategy toggle via /pi-vcc-mr
BadLiveware May 3, 2026
67b0453
feat: add /pi-vcc-off to return control to Pi's built-in
BadLiveware May 3, 2026
b61dcf0
fix: add minimal report to MRC compaction for /pi-vcc-report
BadLiveware May 3, 2026
08f4eb6
fix: remove duplicate PI_VCC_COMPACTION_REPORT_TYPE import
BadLiveware May 3, 2026
d3c05a8
feat: preserve recent read context for continuation
BadLiveware May 5, 2026
546efc3
feat: render addressable MRC keep and ref chunks
BadLiveware May 10, 2026
bb35b03
feat: add append-only MRC lookup refs
BadLiveware May 10, 2026
4263cdb
feat: make MRC refs compaction-stash aware
BadLiveware May 10, 2026
3884ba6
feat!: rename project to pi-mrc
BadLiveware May 10, 2026
788afe5
docs: point install docs at renamed fork
BadLiveware May 10, 2026
29f8745
fix: address MRC review findings
BadLiveware May 10, 2026
e3ebd91
fix: address follow-up MRC review comments
BadLiveware May 10, 2026
97a4cec
fix: cover remaining PR cache and read queue feedback
BadLiveware May 10, 2026
b9b2221
fix: centralize cache gates and raw context dump
BadLiveware May 10, 2026
1e31317
feat: dump raw provider request payloads
BadLiveware May 10, 2026
8056b89
fix: align comparison cache failure counting
BadLiveware May 10, 2026
b9cdfdf
feat: replace sub-goal board with prioritized threads
BadLiveware May 10, 2026
6fdb77b
refactor: rename prioritized threads to subgoals
BadLiveware May 10, 2026
d6bf9db
fix: gate provider payload dumps and session controls
BadLiveware May 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.git
node_modules
dist
*.tsbuildinfo
bun.lock
bench-results*.jsonl
bench-results*.json
.pi*
research
docs
384 changes: 384 additions & 0 deletions .pi/plans/model-reference-compactor.md

Large diffs are not rendered by default.

107 changes: 107 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# AGENTS.md

## Project North Star

`pi-vcc` is an algorithmic conversation compactor for Pi. Its goal is not merely to make summaries shorter; it is to maximize expected continuation value after compaction.

Optimize compaction across these objectives:

1. **Recall fidelity** — important goals, constraints, files, identifiers, evidence handles, decisions, blockers, and next actions remain available either in active context or recall.
2. **Semantic coherence** — the compacted state should let the agent understand what is happening, why it matters, and what to do next.
3. **Post-compaction working room** — active prompt state should stay compact enough to leave useful room for future work.
4. **Retrieval dependence** — bulky or older detail may move out of active context only when it remains recoverable through transcript, recall, files, or artifacts.
5. **Cache preservation** — stable prompt prefixes should remain byte/token stable across ordinary compactions; volatile updates should be isolated into late recent/volatile sections.

A shorter summary is not better if it loses continuity, exact identifiers, recoverability, or cache reuse.

## Compaction Design Principles

- Prefer stable structured state over full-summary rewrites.
- Keep durable facts before volatile facts.
- Keep volatile updates in explicit recent/volatile sections.
- Preserve exact paths, identifiers, error signatures, request IDs, span/probe IDs, and commit references when they are relevant evidence.
- Offload bulky re-fetchable details to recall/history with pointers rather than active prompt bodies.
- Separate current truth from historical transcript. Stale or corrected facts may remain recallable, but must not remain current guidance.
- Treat prompt-cache churn as a first-class performance and cost concern.

## Current Cache-Aware Layout

Stable/current sections should remain as stable as possible:

```text
Session Goal
Files And Changes
Commits
Evidence Handles
User Preferences
Current Scope
```

Recent/volatile sections may change more often and should stay bounded:

```text
Recent Commits
Recent Scope Updates
Recent User Preferences
Recent Evidence Handles
Outstanding Context
Brief Transcript
Kept Raw Tail
```

Do not move volatile content back into stable sections without benchmark-backed evidence.

## Benchmarking Expectations

Use the Docker benchmark path as the primary validation route:

```bash
docker build -t pi-vcc-bench .
docker run --rm pi-vcc-bench --compactors pi-vcc --assert
docker run --rm pi-vcc-bench --compactors pi-vcc --assert-cache
```

For original-vs-current comparisons:

```bash
node scripts/compare-compaction-refs.mjs \
--baseline 53dc551 \
--head HEAD \
--compactors pi-vcc \
--out /tmp/pi-vcc-compaction-compare
```

For real-session cache behavior:

```bash
node scripts/compare-compaction-refs.mjs \
--baseline 53dc551 \
--head HEAD \
--compactors pi-vcc \
--real-only \
--real-sessions-dir ~/.pi/agent/sessions \
--real-limit 5 \
--show-layer-diff \
--out /tmp/pi-vcc-real-compare
```

## Interpreting Results

Good changes should generally:

- preserve or improve correctness assertions
- preserve or improve cache-boundary assertions
- move `firstChangedPromptLayer` later, not earlier
- increase stable-prefix tokens for repeated compactions
- avoid growing full prompt tokens unless the added state is justified
- keep recent/volatile sections bounded

If a change improves one metric while hurting another, judge it by expected continuation value, not by any single metric alone.

## Development Guidance

- Add a focused RED probe before or alongside compaction behavior changes.
- Keep synthetic probes for exact correctness and cache-boundary behavior.
- Use real-session replay to find outliers and avoid overfitting synthetic cases.
- Prefer small semantic commits that can be reviewed and reverted independently.
- Do not claim cache improvements without fresh benchmark evidence.
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# syntax=docker/dockerfile:1

# renovate: datasource=docker depName=oven/bun versioning=semver
ARG BUN_VERSION=1.3.13

FROM oven/bun:${BUN_VERSION} AS source
WORKDIR /app

COPY --link package.json README.md index.ts ./
COPY --link src ./src
COPY --link bench ./bench
COPY --link scripts ./scripts

FROM oven/bun:${BUN_VERSION} AS final
ENV NODE_ENV=production

COPY --link --from=source --chown=1000:1000 /app /app
WORKDIR /app
USER bun

ENTRYPOINT ["bun", "scripts/bench-compaction.ts"]
CMD ["--jsonl"]
Loading