{"_id":"@anshulluhsna/compaction-orchestrator","name":"@anshulluhsna/compaction-orchestrator","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@anshulluhsna/compaction-orchestrator","version":"0.1.0","description":"Control which compaction strategy your agent uses for each turn and context segment.","license":"MIT","type":"module","sideEffects":false,"homepage":"https://github.com/anshulLuhsna/compaction-orchestrator#readme","repository":{"type":"git","url":"git+https://github.com/anshulLuhsna/compaction-orchestrator.git","directory":"packages/core"},"bugs":{"url":"https://github.com/anshulLuhsna/compaction-orchestrator/issues"},"keywords":["ai","agents","context","compaction","memory","llm","sdk","orchestration"],"main":"./dist/index.js","types":"./dist/index.d.ts","bin":{"compaction-orchestrator":"dist/cli.js"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./store":{"types":"./dist/store.d.ts","import":"./dist/store.js"}},"scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit"},"dependencies":{"zod":"^3.25.67"},"publishConfig":{"access":"public"},"devDependencies":{"typescript":"^5.8.3"},"gitHead":"fe6923e72094558ec4113a9a10a476818f932619","_id":"@anshulluhsna/compaction-orchestrator@0.1.0","_nodeVersion":"25.2.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-00r/YYci65O/3XtD1FxzIbhWzjFVNC3VvMU+AUy3sBVRhYFOA2c5WdImT8KxoC6KlLQ/MS3+B8pdRHDSqvTJtQ==","shasum":"9ea0ab4078663e2a5c1273f3256e79e7744491e6","tarball":"https://registry.npmjs.org/@anshulluhsna/compaction-orchestrator/-/compaction-orchestrator-0.1.0.tgz","fileCount":39,"unpackedSize":157722,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQClrsMLhEmKYjdEtK/wRYMlmF/5InGkwTjmRirW2PCnyAIhAKHNf/6pUCij6sZvbAG2dtJEkX88gAmM+gzzJ2jaQnz6"}]},"_npmUser":{"name":"anshulluhsna","email":"anshulkalbande@gmail.com"},"directories":{},"maintainers":[{"name":"anshulluhsna","email":"anshulkalbande@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/compaction-orchestrator_0.1.0_1782044709978_0.9036366829735183"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-21T12:25:09.875Z","0.1.0":"2026-06-21T12:25:10.135Z","modified":"2026-06-21T12:25:10.290Z"},"maintainers":[{"name":"anshulluhsna","email":"anshulkalbande@gmail.com"}],"description":"Control which compaction strategy your agent uses for each turn and context segment.","homepage":"https://github.com/anshulLuhsna/compaction-orchestrator#readme","keywords":["ai","agents","context","compaction","memory","llm","sdk","orchestration"],"repository":{"type":"git","url":"git+https://github.com/anshulLuhsna/compaction-orchestrator.git","directory":"packages/core"},"bugs":{"url":"https://github.com/anshulLuhsna/compaction-orchestrator/issues"},"license":"MIT","readme":"# @anshulluhsna/compaction-orchestrator\n\nControl which compaction strategy your agent chooses for each turn and context segment.\n\nThis package is the SDK and CLI for Compaction Orchestrator. It is not just another summarizer. It gives agent builders a programmable compaction control layer: preserve instructions verbatim, extract active errors, externalize noisy tool output, summarize completed exploration, and return a compact runtime context for the next model call.\n\n## Install\n\n```bash\nnpm install @anshulluhsna/compaction-orchestrator\n```\n\n## SDK\n\n```ts\nimport { compact } from \"@anshulluhsna/compaction-orchestrator\";\n\nconst result = compact({\n  messages,\n  objective: \"Prepare context for the next agent turn.\",\n  desiredBudget: 1200,\n  policy: {\n    mode: \"balanced\",\n    preserveUserMessagesVerbatim: true,\n    allowExternalRetrieval: true\n  }\n});\n\nconsole.log(result.contextView.content);\nconsole.log(result.plan.segments.map((segment) => segment.operation));\n```\n\n## Customer Support Package\n\n```ts\nimport { compactCustomerSupport } from \"@anshulluhsna/compaction-orchestrator\";\n\nconst handoff = compactCustomerSupport({\n  messages,\n  objective: \"Prepare a reliable support handoff.\",\n  useCase: \"customer_support\"\n});\n\nconsole.log(handoff.contextPackage.issue);\nconsole.log(handoff.contextPackage.nextActions);\n```\n\n## CLI\n\n```bash\nnpx @anshulluhsna/compaction-orchestrator examples/coding-agent-session.json\n```\n\nYou can also pipe JSON through stdin:\n\n```bash\ncat session.json | npx @anshulluhsna/compaction-orchestrator\n```\n\nImport Claude Code or Codex transcripts into UI-ready fixtures:\n\n```bash\nnpx @anshulluhsna/compaction-orchestrator import claude ~/.claude/projects/<project>/<session>.jsonl \\\n  --out my-claude-session.json\n\nnpx @anshulluhsna/compaction-orchestrator import codex ~/.codex/sessions/YYYY/MM/DD/rollout-...jsonl \\\n  --out my-codex-session.json\n```\n\n## Persistence\n\nThe package root is SDK-first. Persistence is available through an explicit subpath:\n\n```ts\nimport { SqliteStore } from \"@anshulluhsna/compaction-orchestrator/store\";\n```\n\nSQLite is useful for local API/server workflows where you want durable sessions, compaction plans, context views, and externalized content.\n\n## Strategy Routing\n\nCompaction Orchestrator supports different strategies per turn and per segment. A single agent turn can produce a mixed plan such as:\n\n- `keep_verbatim` for user constraints\n- `extract_active_error` for the current failure\n- `externalize_for_retrieval` for large logs\n- `structured_summary` for completed exploration\n\nThe result is smaller context with more control over what survives.\n","readmeFilename":"README.md","_rev":"1-220f5910ed57aac66a8325bc6c3260da"}