Architecture
Module boundaries
TokenDanceCode is built from four modules, each with a clear job:
Runtime (core engine) — Manages model providers, tool registration and execution, permission decisions, and conversation transcripts. You interact with it through the CLI or SDK; you don’t need to understand internals.
SDK (programmatic entry point) — Lets external systems (like AgentHub) or your own scripts start conversation threads, subscribe to event streams, and handle remote approvals in code. It exposes a stable public API — core internals stay internal.
CLI (command-line tool) — The tokendance executable itself, including the interactive terminal and all slash commands. When you type tokendance run, this is what runs.
AgentHub integration layer — Bridge code that connects the local runtime to the AgentHub remote collaboration platform. Handles event reporting, remote approval forwarding, and session persistence.
Runtime data
TokenDanceCode writes all local state under the .tokendance directory:
- Transcript — Complete JSONL record of every conversation, searchable, replayable, and exportable
- Task / Todo — Persistent task and to-do state
- Memory — Cross-session memory storage
- Subagent event logs — Independent execution records for sub-agents
- Worktree metadata — Metadata management for isolated workspaces
All data is accessed through SDK facades. AgentHub can persist and broadcast these events, but you should not depend on core runtime internals to read or write state.