Skip to content

About

Multi-model Agent context handoff packet CLI — compress OpenAI-compatible messages into a paste-ready resume pack.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

handoff-pack

English | 简体中文

A local-first CLI for carrying agent context from one model or session to another. It turns OpenAI-compatible messages into a Markdown handoff or JSON packet, prioritizing system instructions, tool/error signals and recent conversation.

Quick start

Requires Node.js 18 or newer. No npm dependencies, account or API key are needed for the bundled example.

git clone https://github.com/ktz03/handoff-pack.git
cd handoff-pack
node bin/handoff-pack.js preview examples/long.session.json --max-tokens 200
node bin/handoff-pack.js pack examples/long.session.json --max-tokens 200 --out RESUME.md

The bundled example has 19 messages. In a local Node.js 24 run, the preview estimated 508 → 181 tokens and reported one redaction. This is one synthetic example; token counts and results depend on the input.

For a structured packet, add --json and choose a JSON output path:

node bin/handoff-pack.js pack examples/long.session.json --max-tokens 200 --json --out handoff.packet.json

Input and output

Input is either an array of OpenAI-compatible message objects or an object with a messages array. A message can contain text, structured content and tool-call fields.

  • preview <file> shows estimated token counts, compression, redaction count and retained roles.
  • pack <file> writes Markdown by default; --json writes a JSON packet.
  • --max-tokens N sets the approximate message budget; --out path selects the output file.

The packet includes task hints extracted from retained messages, a pasteable message history and generic next-action/plan templates. The templates are static suggestions, not a model-generated analysis of the task.

Privacy and limits

  • Redaction scans string values throughout each message, including nested content, tool calls and metadata, for a limited set of patterns: OpenAI-style sk- keys, classic GitHub ghp_ tokens, AWS access-key IDs, bearer tokens and PEM private-key blocks. Incomplete recognized PEM blocks are removed through the end of the string.
  • Detection is best effort, not a guarantee. Other secret formats, sensitive information, object keys and paths may remain. Inspect the entire output before sharing it. The packet records the absolute source-file path.
  • Token counts are rough character-based estimates of message content plus fixed per-message overhead; they do not count every field. System messages are always retained, so the budget is not a hard upper bound.

Tests

npm test

The test runner requires Node.js 18.1 or newer. It runs the existing pack tests and regression tests for nested redaction, PEM blocks and both CLI output formats. No external service is needed.

License

MIT

About

Multi-model Agent context handoff packet CLI — compress OpenAI-compatible messages into a paste-ready resume pack.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages