acp-kernel Provenance Audit

July 31, 2026 · View on GitHub

This document classifies every source file in opencode-acp/lib/ (the donor) into one of three buckets, to determine what can be carried into the MIT acp-kernel and what must be reimplemented in fresh expression.

Method: exact path comparison of opencode-acp (the ACP fork, 82 lib/*.ts files) against the upstream DCP repository (66 lib/*.ts files). A file that has no DCP equivalent is original work (bucket A). A file with a DCP equivalent at the same path is a DCP derivative — its expression is AGPL-bound regardless of how much it was later changed (derivation is judged by whether a file was created by transforming the original, not by % changed; per copyright law expression is protected, not ideas/methods/algorithms).


Legend

BucketMeaningAction in acp-kernel
ANo DCP equivalent → original work of ranxiangleiBring verbatim (the author's own code, MIT-safe). License header rewritten to MIT.
BDCP-derived file (same path exists upstream) → derivative expression is AGPLReimplement in fresh expression using the author's algorithm; do NOT copy/refactor the file's code.
N/AAdapter-only (framework-specific: opencode hooks, I/O, auth, commands, UI)Excluded from the pure core. Stays in host adapters. Origin irrelevant.

Bucket A — Original work (bring verbatim) — 30 files

Quality gate intentionally omitted from acp-kernel (may be added later if needed).

compress/

FileNotes
compress/decompress.tsACP-original (v1.11+); DCP has no decompress
compress/decompress-logic.tsACP-original
compress/hide-consumed.tsACP-original (v1.14+)
compress/hide-failed.tsACP-original
compress/keep-markers.tsACP-original (v1.12+)
compress/parts.tsACP-original
compress/recap.tsACP-original (v1.12.1)
compress/status.tsACP-original (v1.11+)

other

FileNotes
config-validation.tsACP-extracted for testability; no DCP equivalent
gc/merge.tsACP-original (DCP has no gc/ dir)
messages/truncate-tools.tsACP-original (v1.14.5, replaced DCP's gc/truncate.ts)
messages/filter/* (9 files)ACP-original filtering subsystem
messages/inject/policy/* (3 files)ACP-original (v1.13.1) — inject policy logic, not rendering
state/rebuild.tsACP-original (v1.11+)

Bucket B — DCP-derived (reimplement in fresh expression) — 40 files

Only the algorithmic subset is reimplemented into the pure core; the rest are adapter-only (persistence, config-merge, prompts-rendering) and excluded from the core. Listed by what they become.

Reimplemented into acp-kernel (fresh expression, ~9 substantial files)

DCP-derived fileBecomesWhat to reimplement
compress/range.tscore/applyCompression (range mode)block allocation, nested-block handling, boundary resolution
compress/search.tscore/resolveBoundariesref→index mapping, reversed-boundary swap, protected-gap detection
compress/state.tscore/state (mutation)block id/run allocation, deactivation, byMessageId index
compress/pipeline.tscore/processTurn prep/finalizepermission (host-side), fetch (host-side), state wrap
messages/prune.tscore/prunereplace compressed ranges with summary blocks
messages/sync.tscore/syncdeactivate orphaned blocks when messages deleted
message-ids.tscore/refsraw↔mNNNNN bidirectional map
messages/inject/inject.ts + inject/utils.tscore/decideNudgedecision only — shouldNudge, growth baseline, threshold, compressible ranges
config.ts (core subset)core/Config defaultsdefaults + validation (use A-class config-validation.ts)

Supporting types/barrels (trivial, write fresh)

compress/{index,types,timing,range-utils}.ts, messages/{index,priority,query,reasoning-strip,shape,utils}.ts, state/{index,types,utils}.ts, token-utils.ts (wrap cc-alg tokenizer), protected-patterns.ts, compress/protected-content.ts.

Excluded from core (adapter-only despite B lineage)

state/persistence.ts (filesystem I/O), prompts/* (text rendering → adapter), compress-permission.ts (permission = host concern).


Bucket N/A — Adapter-only (excluded from core) — 12 files

All framework-specific; irrelevant to the pure core. Stay in the OpenCode adapter (and a future Pi adapter).

auth.ts, hooks.ts, host-permissions.ts, logger.ts, update.ts, ui/notification.ts, ui/utils.ts, commands/{compression-targets,context,index,stats}.ts, compress-permission.ts.


Summary

BucketFilesDisposition
B DCP-derived40~9 substantial algorithms reimplemented fresh + ~12 types/barrels rewritten fresh; rest excluded (adapter)
N/A adapter12excluded from core

Compliance note

This audit exists to ensure acp-kernel is genuinely MIT, not "MIT-labeled but AGPL-tainted." The rule applied throughout: an idea/algorithm is free regardless of source; a file's code expression is bound to the license of the file it descends from. A-class files descend from no DCP file. B-class files' code is NOT carried — the algorithms are reimplemented in new expression. Should any contributor question a classification, the comparison data above (and the upstream DCP tree) allow independent verification.