$ show paean-ai/deeptide
DeepTide is a cross-platform terminal AI coding agent. The Rust workspace (deeptide-core, deeptide-host, deeptide-cli, deeptide-gui) implements the production agent engine: an interactive REPL session with an agent loop, tool dispatch (bash, edit, web, git, memory, MCP, LSP, vision, cron, planning), cross-provider model routing with local-first/cloud-escalation policies, cost tracking, tokens-per-second telemetry, tool usage observability, durable memory with BM25 retrieval ranking, session import/checkpoint/rewind, sensitive-file read protection, and a theme system for syntax highlighting and diffs. The CLI and GUI share a common host layer, and the npm package downloads prebuilt Rust binaries. Architecturally it is a multi-crate Rust workspace plus supporting native components: native/ds4 is a hard-forked DeepSeek V4 Flash Metal inference engine for local LLM execution, and native/dsgo is a Swift gateway that translates between Anthropic and OpenAI protocols with SSE streaming. Primary entry points are crates/deeptide-cli/src/main.rs (CLI), crates/deeptide-gui/src/main.rs (eframe/egui GUI), and bin.js (Bun launcher that delegates to @paean-ai/zero-cli). External dependencies include DeepSeek/Anthropic/OpenAI-compatible APIs, local Metal GPU inference, and GitHub Releases for binary distribution. The repo also contains 50+ self-contained HTML5 Canvas pixel-art games and Three.js showcases under samples/, which appear to be AI-generated demo content demonstrating agent output quality rather than core product code. These share heavily duplicated boilerplate (seeded RNG, localStorage save/load, bilingual i18n, screen state machines). The core Rust code is well-tested with integration tests covering routing, cost tracking, memory ranking, tool result summarization, and slash commands; live API tests are marked #[ignore]. Hybrid note: while primarily an application, it contains research-oriented elements such as memory capture benchmarks (benchmarks/auto_capture_bench.py), prompt cache layout benchmarks (benchmarks/cache_memory_bench.py), and deterministic puzzle generation algorithms with uniqueness verification.
The LLM identified 6 files worth highlighting for reuse:
RoutingBackend implements the AgentBackend trait and routes turns to a primary local backend with optional escalation to a cloud backend via an EscalationPolicy enum (Manual or OnError). It is a self-contained, generic failover/override pattern that could be extracted into any multi-provider LLM client with minimal modification.
Self-contained BM25-based retrieval ranker with a recency nudge, accepting Vec<RankDoc> and returning scored indices. Includes stopword filtering and is validated by a benchmark asserting MRR/precision@1 gains over substring baselines. Extractable as a standalone ranking utility for any document retrieval task.
Dependency-free token-level diff that returns aligned span pairs for intra-line highlighting. A clean, isolated utility that could be reused in any editor, terminal UI, or code review tool without pulling in external diff crates.
Blocks reads of sensitive files (.env, .pem, etc.) unless explicitly opened via /open. A self-contained security gate pattern demonstrating non-obvious safety engineering for agent file access; reusable in any tool-execution or agent context.
Generates follow-up prompt suggestions without any model call, based on turn signals such as edited files, errors, and TODOs. A deterministic, self-contained UX pattern for AI assistants that avoids extra LLM latency and cost.
Translates Anthropic-formatted requests to OpenAI format and back, with SSE streaming for a local DeepSeek runtime. A reusable protocol-adapter pattern for any service needing to speak multiple LLM wire protocols.