[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D69B0ANKBGMBDPY0EQP3FG":3,"skill-same:01M7D69B0ANKBGMBDPY0EQP3FG":55},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":31,"commitSha":32,"skillDirectory":33,"forksCount":34,"repositoryHtmlUrl":35,"repositoryHomepageUrl":36,"ownerHtmlUrl":37,"ownerBlogUrl":38,"ownerDescription":39,"updatedAt":40,"install":41,"resources":54},"01M7D69B0ANKBGMBDPY0EQP3FG","lossless-core",null,"Use when wiring a host to lossless-core or working on the engine itself: implement ModelHost or Reader, run a compaction, retrieval, or heal pass, or read the store directly with LcmStore.","stainless-code\u002Flossless","stainless-code","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F188862219?v=4","01M7826VYMCF2NTQWQZRWQ454T","STAINLESS CODE","01M7D663576JS718B5NKJTEXHZ",4,"MIT","https:\u002F\u002Fgithub.com\u002Fstainless-code\u002Flossless\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fskills\u002Flossless-core\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: lossless-core\ndescription: \"Use when wiring a host to lossless-core or working on the engine itself: implement ModelHost or Reader, run a compaction, retrieval, or heal pass, or read the store directly with LcmStore.\"\nlicense: MIT\nmetadata:\n  type: core\n  library: \"lossless-core\"\n  library_version: \"0.1.3\"\nsources:\n  - stainless-code\u002Flossless:packages\u002Fcore\u002Fsrc\u002Fhost.ts\n  - stainless-code\u002Flossless:packages\u002Fcore\u002Fsrc\u002Findex.ts\n  - stainless-code\u002Flossless:packages\u002Fcore\u002FREADME.md\n---\n\n# Lossless core\n\nUse it when implementing a host adapter or touching the engine. Do not use it\nfor adapter commands: Pi subcommands live in the pi-lossless skill,\n`lossless-*` commands in the opencode-lossless skill.\n\nThe engine behind `pi-lossless` and `opencode-lossless`: Lossless Context\nManagement for a long-running agent. Every message is stored verbatim,\naged context is replaced with searchable pointers, and the original text\nstays readable by id, entry, or search.\n\n## Minimal wiring\n\n```ts\nimport { LcmStore, runCompaction, runHeal, runRetrieval } from \"lossless-core\";\nimport type { ModelHost, Reader } from \"lossless-core\";\n```\n\nCall shapes (full signatures in `src\u002Findex.ts`, port contracts in `src\u002Fhost.ts`):\n\n```ts\nconst store = new LcmStore(dbPath);\nawait runCompaction(store, input, llm); \u002F\u002F input: CompactionInput (span, budgets)\nawait runRetrieval(store, request, reader); \u002F\u002F request: RetrievalRequest (scope, query)\nawait runHeal(store, { dryRun: true }, llm); \u002F\u002F HealInput: maxNodes, maxCalls, dryRun plan mode\n```\n\nThe engine has no agent SDK dependency. A host supplies two ports and the\nengine does the rest. Pi implements both; the OpenCode v2 adapter implements\n`ModelHost` and runs retrieval in a host child session instead of `Reader`.\n\n## What it does\n\n- **Ingest.** Every message lands in SQLite with its entry id, role,\n  timestamp, and any file handle the host attached.\n- **Compaction.** Past a swap ratio, a pass summarizes spans into leaf and\n  condensed nodes and leaves a pointer in place. Nothing is deleted.\n- **Retrieval.** A reader answers by calling `lcm_grep`, `lcm_describe`,\n  and `lcm_expand`, so the answer cites what was read.\n- **Repair.** `runHeal` re-derives a truncated summary and its ancestors\n  from the provenance rows they still point at.\n- **Redaction.** Secret-shaped text is masked on the way to a model, never\n  at the door, so an export or read still returns what was stored.\n\n## The two ports\n\n`src\u002Fhost.ts` documents both. `ModelHost` is what the engine calls a model\nthrough: `session()`, `find()`, `complete()`, plus where notices go.\n`Reader` is one retrieval conversation: `begin()` returns a `Reading`\nwhose `next()` appends results and returns the model reply.\n\n| Type        | Question it answers                                   |\n| ----------- | ----------------------------------------------------- |\n| `ModelHost` | Which model, and what did it answer                   |\n| `Reader`    | What did the reader ask for, and what did it conclude |\n\n## Boundary rule\n\nNo module under `src\u002F` imports an agent SDK, a bare specifier other than\n`node:*` and `typebox`, or a file outside the engine. The boundary test\nfails any violation. Import the package root only.\n\n## Common mistakes\n\n- **Importing engine source deep paths** (`lossless-core\u002Fdist\u002F...` or\n  relative `src\u002F...` files) instead of the package root — the boundary test\n  fails deep imports; `import { LcmStore } from \"lossless-core\"` is the only entry.\n- **Expecting a host SDK in the bundle** - the host always supplies\n  `ModelHost` (and `Reader`, unless the host runs retrieval itself, as the OpenCode adapter does); implement the port, never `npm install` an SDK.\n- **Assuming compaction deletes** - pointers replace text in context,\n  the verbatim rows stay queryable via the recall views.\n- **Redacting at write time** - masking happens on the model path only; a stored row is never rewritten.\n\n## API surface\n\n- `LcmStore`, `runCompaction`, `runRetrieval`, `runHeal` — exported from `src\u002Findex.ts`; pass and heal options live next to their runners.\n- `ModelHost`, `Reader`, `Reading` (types, `src\u002Fhost.ts`) — the two port contracts; implement these, never a host SDK.\n","# Lossless core\n\nUse it when implementing a host adapter or touching the engine. Do not use it\nfor adapter commands: Pi subcommands live in the pi-lossless skill,\n`lossless-*` commands in the opencode-lossless skill.\n\nThe engine behind `pi-lossless` and `opencode-lossless`: Lossless Context\nManagement for a long-running agent. Every message is stored verbatim,\naged context is replaced with searchable pointers, and the original text\nstays readable by id, entry, or search.\n\n## Minimal wiring\n\n```ts\nimport { LcmStore, runCompaction, runHeal, runRetrieval } from \"lossless-core\";\nimport type { ModelHost, Reader } from \"lossless-core\";\n```\n\nCall shapes (full signatures in `src\u002Findex.ts`, port contracts in `src\u002Fhost.ts`):\n\n```ts\nconst store = new LcmStore(dbPath);\nawait runCompaction(store, input, llm); \u002F\u002F input: CompactionInput (span, budgets)\nawait runRetrieval(store, request, reader); \u002F\u002F request: RetrievalRequest (scope, query)\nawait runHeal(store, { dryRun: true }, llm); \u002F\u002F HealInput: maxNodes, maxCalls, dryRun plan mode\n```\n\nThe engine has no agent SDK dependency. A host supplies two ports and the\nengine does the rest. Pi implements both; the OpenCode v2 adapter implements\n`ModelHost` and runs retrieval in a host child session instead of `Reader`.\n\n## What it does\n\n- **Ingest.** Every message lands in SQLite with its entry id, role,\n  timestamp, and any file handle the host attached.\n- **Compaction.** Past a swap ratio, a pass summarizes spans into leaf and\n  condensed nodes and leaves a pointer in place. Nothing is deleted.\n- **Retrieval.** A reader answers by calling `lcm_grep`, `lcm_describe`,\n  and `lcm_expand`, so the answer cites what was read.\n- **Repair.** `runHeal` re-derives a truncated summary and its ancestors\n  from the provenance rows they still point at.\n- **Redaction.** Secret-shaped text is masked on the way to a model, never\n  at the door, so an export or read still returns what was stored.\n\n## The two ports\n\n`src\u002Fhost.ts` documents both. `ModelHost` is what the engine calls a model\nthrough: `session()`, `find()`, `complete()`, plus where notices go.\n`Reader` is one retrieval conversation: `begin()` returns a `Reading`\nwhose `next()` appends results and returns the model reply.\n\n| Type        | Question it answers                                   |\n| ----------- | ----------------------------------------------------- |\n| `ModelHost` | Which model, and what did it answer                   |\n| `Reader`    | What did the reader ask for, and what did it conclude |\n\n## Boundary rule\n\nNo module under `src\u002F` imports an agent SDK, a bare specifier other than\n`node:*` and `typebox`, or a file outside the engine. The boundary test\nfails any violation. Import the package root only.\n\n## Common mistakes\n\n- **Importing engine source deep paths** (`lossless-core\u002Fdist\u002F...` or\n  relative `src\u002F...` files) instead of the package root — the boundary test\n  fails deep imports; `import { LcmStore } from \"lossless-core\"` is the only entry.\n- **Expecting a host SDK in the bundle** - the host always supplies\n  `ModelHost` (and `Reader`, unless the host runs retrieval itself, as the OpenCode adapter does); implement the port, never `npm install` an SDK.\n- **Assuming compaction deletes** - pointers replace text in context,\n  the verbatim rows stay queryable via the recall views.\n- **Redacting at write time** - masking happens on the model path only; a stored row is never rewritten.\n\n## API surface\n\n- `LcmStore`, `runCompaction`, `runRetrieval`, `runHeal` — exported from `src\u002Findex.ts`; pass and heal options live next to their runners.\n- `ModelHost`, `Reader`, `Reading` (types, `src\u002Fhost.ts`) — the two port contracts; implement these, never a host SDK.\n",{"name":5,"license":15,"sources":24,"metadata":28,"description":7},[25,26,27],"stainless-code\u002Flossless:packages\u002Fcore\u002Fsrc\u002Fhost.ts","stainless-code\u002Flossless:packages\u002Fcore\u002Fsrc\u002Findex.ts","stainless-code\u002Flossless:packages\u002Fcore\u002FREADME.md",{"type":29,"library":5,"library_version":30},"core","0.1.3","main","9dedf1fabe7ea6b6eca1d6fa93a2dde3a5f37061","packages\u002Fcore\u002Fskills\u002Flossless-core",0,"https:\u002F\u002Fgithub.com\u002Fstainless-code\u002Flossless","https:\u002F\u002Fstainless-code.com\u002Flossless","https:\u002F\u002Fgithub.com\u002Fstainless-code","https:\u002F\u002Fstainless-code.com\u002F","Open-source tooling for JS\u002FTS and AI agents.","2026-11-07 02:31:20",{"source":8,"skillName":5,"commands":42,"prompt":52,"zipAvailable":53},[43,46,49],{"tool":44,"command":45},"npx","npx skills add stainless-code\u002Flossless --skill lossless-core",{"tool":47,"command":48},"bunx","bunx skills add stainless-code\u002Flossless --skill lossless-core",{"tool":50,"command":51},"pnpm","pnpm dlx skills add stainless-code\u002Flossless --skill lossless-core","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fstainless-code\u002Flossless\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fskills\u002Flossless-core\u002FSKILL.md",true,[],[56,63],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7D69NGNTGBGWSQ3CZ4D7R1C","pi-lossless","Use when a Pi session has pi-lossless installed: search compacted history with lcm_grep, lcm_describe, or lcm_expand_query; run \u002Flcm status, settings, backup, export, report, doctor, gc, migrate, heal, dump, or diagnose; or tune compaction thresholds.","https:\u002F\u002Fgithub.com\u002Fstainless-code\u002Flossless\u002Fblob\u002Fmain\u002Fpackages\u002Fpi\u002Fskills\u002Fpi-lossless\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7D69EX86GETFDFKG0VY984B","opencode-lossless","Use when an OpenCode v2 session has opencode-lossless installed: read compacted history with lcm_grep, lcm_describe, lcm_expand, or lcm_expand_query; run \u002Flossless-status, \u002Flossless-report, \u002Flossless-pass, \u002Flossless-heal, \u002Flossless-backup, \u002Flossless-export, \u002Flossless-import, \u002Flossless-diagnose, \u002Flossless-migrate, \u002Flossless-gc, or \u002Flossless-dump; or tune the swap point.","https:\u002F\u002Fgithub.com\u002Fstainless-code\u002Flossless\u002Fblob\u002Fmain\u002Fpackages\u002Fopencode\u002Fskills\u002Fopencode-lossless\u002FSKILL.md",[],[]]