A Go CLI and library for intelligent topic-based context management when chatting with Claude. Instead of naively truncating conversation history when approaching token limits, nostop detects topic shifts, scores relevance, and archives low-relevance topics to SQLite — preserving full message content for later restoration.
- Topic detection — Uses Claude Haiku as a sidecar model to identify conversation topic shifts in real time
- Dynamic context allocation — Current topics receive more context budget; older topics receive proportionally less based on relevance scoring
- Archive, don't compact — Full messages are preserved verbatim in SQLite, not summarized or truncated
- Automatic archival — At 95% context usage, archives lowest-relevance topics until usage drops to 50%
- Topic restoration — Archived topics can be brought back into active context when referenced
- Prompt caching — Integrates with Anthropic's cache control API (5m and 1h TTLs) to reduce costs on repeated system prompts
- Streaming — Full SSE streaming support with callback-based API
- TUI — Four-view Bubbletea interface: Chat, History, Topics, and Debug
- Go 1.24+
- An Anthropic API key
go install github.com/hegner123/nostop/cmd/nostop@latestBuild from source:
git clone https://github.com/hegner123/nostop.git
cd nostop
just build
just installSet your API key:
export ANTHROPIC_API_KEY="sk-ant-..."Start the TUI:
nostopGenerate a default config file:
nostop --write-confignostop searches for config files in order:
./nostop.toml~/.config/nostop/config.toml~/.nostop.toml
Key settings in nostop.toml:
[context]
max_tokens = 200000 # Model context limit
archive_threshold = 0.95 # Trigger archival at this usage %
archive_target = 0.50 # Archive until usage drops to this %
[models]
chat = "claude-sonnet-4-20250514"
detection = "claude-3-5-haiku-latest"| Key | Action |
|---|---|
ctrl+n |
New conversation |
ctrl+h |
History view |
ctrl+t |
Topics view |
ctrl+d |
Debug view |
tab / shift+tab |
Cycle views |
r (Topics view) |
Restore archived topic |
nostop can be used as a Go library:
engine, err := nostop.New(nostop.Config{
APIKey: os.Getenv("ANTHROPIC_API_KEY"),
DBPath: "conversations.db",
MaxContextTokens: 200000,
ChatModel: "claude-sonnet-4-20250514",
DetectionModel: "claude-3-5-haiku-latest",
})
defer engine.Close()
conv, _ := engine.NewConversation(ctx, "My Chat", "You are helpful.")
resp, _ := engine.Send(ctx, conv.ID, "Hello!")
fmt.Println(resp.Content)See CONTRIBUTING.md.
MIT. See LICENSE.