Tianshu is a coding-agent runtime written in TypeScript that shares one agent kernel between a terminal interface and a Tauri desktop app for macOS, Windows, and Linux. It runs multi-step coding tasks rather than answering single questions, with runtime guardrails, multi-agent orchestration, and prompt construction tuned for prefix caching on long sessions. The installed command is still rivet, the project's original development codename.
The prompt engine is built around prefix-cache stability. System prompt, tool definitions, and stable context are frozen at session start; dynamic context is appended as cross-turn diff blocks of roughly 200 bytes rather than a full rewrite; repeated reads of unchanged files return compact references; compaction keeps the first two messages as cache anchors; and a frozen snapshot is written to disk so a resumed session inherits the cache. Measured steady-state hit rates on long DeepSeek V4 sessions are 95–99%, and a /debug cache command reports hit rate, miss causes, and per-turn history. Cost controls include lowered default reasoning effort, automatic down-routing on low-complexity turns, and a doom-loop detector that injects tighter output constraints.
A cognitive virtual machine sits between model output and real actions in four layers: a static belief prompt, a Courage hook at turn start, a six-dimension state sensor evaluated each turn in under a millisecond, and a pipeline of 72 runtime hooks that intercepts recurring degeneration patterns. A published A/B run on DeepSeek-V4-Flash over the same five tasks, with the runtime toggle as the only variable, reports 5/5 versus 4/5 task completion and 3/5 versus 0/5 runs where the agent raised an objection.
Sub-tasks are delegated to headless worker sessions with typed work orders — codesearch, review, verify, patchproposal, plan — read-only versus writing tool isolation, adaptive model routing scored by pass rate and latency, batch scheduling, and optional subprocess isolation. Fifty built-in tools are assembled by preset: minimal (29), frontend (30, the default), full (50), and taiyi (16).
| Provider | Flagship models |
|---|---|
| DeepSeek | deepseek-v4-pro (1M context), deepseek-v4-flash, deepseek-v4-flash-vision-exp |
| Claude | claude-opus-4-8, claude-sonnet-4-5 |
| GLM | glm-5.3 (1M context), glm-5.3-flash, glm-5.2 |
| Codex | gpt-5.6-sol (OAuth) |
| MiniMax | MiniMax-M3, MiniMax-M2.7 |
| MiMo | mimo-v2.5-pro |
Features
- Prefix-cache engine: frozen prefix, incremental appendix, read-reference deduplication, cache-aware compaction, resume inheritance, and a cache diagnostic command
- Cognitive virtual machine: four defence layers and 72 runtime hooks between model output and executed action
- Sub-agent orchestration: typed work orders, read-only and writing workers, adaptive model routing, batch scheduling, and optional subprocess isolation
- Multi-agent commands: read-only scouting, wave-parallel team execution, and multi-seat council review with an optional rebuttal round
- Tool presets: 50 built-in tools assembled in minimal, frontend, full, and taiyi tiers, switchable per session, project, or domain
- Cross-session memory: project knowledge in a JSONL store with explicit recall, deep recall, auto-capture, consolidation, and an invalidate-rather-than-delete lifecycle
- Plan mode and goals: design-first planning plus goal-driven auto-continuation with delivery gates
- Rewind: a double-Escape history picker that restores a past point by conversation only, code changes only, or both
- Skills: reusable workflow playbooks with two-stage disclosure and project skills loaded from markdown with YAML frontmatter
- MCP support: stdio and network servers discovered at startup and exposed under the same approval model as built-in tools
- Terminal interface: an in-house ANSI renderer with a status bar, mid-stream steering, message queueing, and inline images
