Inspiration

Most AI coding assistants outsource their interaction layer to ratatui, Electron, or a web frontend, and the "invisible engineering" — rendering, interruption, session persistence, context caching — gets swallowed by one framework after another. We wanted to do the opposite: build everything ourselves, from the terminal grid and diff renderer to the round/turn model of a single conversation, and see how far a Rust coding agent can go when it fully owns its runtime. That is where neenee was born — a local agent that keeps its control plane in its own hands, and then extends that same agent core into quantitative decision-making, to test whether one kernel can serve a workflow that is "partly writing code, partly doing trade research."

What it does

neenee is a Rust-based AI coding and decision agent with three faces:

  • Semantic TUI coding assistant (neenee-code) — a from-scratch grid + diff rendering engine (neenee-tui), with live status, expandable tool steps, and structured diffs; a full ReAct tool loop (bash, file I/O, grep, glob, web search, MCP servers); and pluggable model providers (Anthropic / OpenAI / Gemini / Moonshot / Copilot, etc.).
  • Autonomous pursuits/pursue <condition> drives a turn forward with a stop-gate until the condition is met; /repeat <cron> <prompt> schedules prompts on a clock; opt-in turns/tokens/time budgets can cap a pursuit and fire a convergence reminder at 75%.
  • Quantitative decision workbench (neenee-quant-gui + neenee-intelligence) — collects ranked public-web signals, observes key links for change (HTTP validators with a SHA-256 fingerprint fallback), and runs a "five-perspective expert council + cross-examination + meeting-manager synthesis" multi-round review; real-time quotes, depth, positions, and order submission flow through the official LongPort Rust SDK, with local risk checks, audit records, and an explicit arming step.

How we built it

  • Workspace topologyapps/code (neenee-code, neenee-tui, neenee-tui-view), apps/quant (neenee-quant, neenee-quant-gui, neenee-intelligence), crates/platform, crates/providers, with versions and lint policy pinned once in Cargo.toml.
  • TUI engine — a retained-mode grid with write-marks-dirty diffing, wide-glyph ownership, and a bce-aware crossterm backend; no ratatui dependency.
  • Round / turn model — a two-layer execution model (round vs turn) paired with a harness control plane, pursuit state, and safety bounds; sessions are persisted atomically with compaction, resume, and fork.
  • Pluggable providers — a capability model abstracts away vendor differences, with both native and fallback tool-calling paths. ADR-0067's CachePolicy classifier resolves each model family's caching strategy (Breakpoints / SessionKey / Automatic) so OpenAI, Gemini, Moonshot, and Anthropic all report cache hits.
  • Decision intelligenceneenee-intelligence is a standalone crate that persists the last good result per source and degrades gracefully on failure; every conclusion from the expert council is advisory and never sits on the order path.
  • Documentation governance — docs are split into how-to / reference / explanation / dev, and every architecture decision flows through ADRs (currently up to ADR-0069).

Challenges we ran into

  • Writing a TUI renderer from scratch — wide characters, emoji, double-width placeholders, terminal bce behavior all had to be decided by us; we ultimately drove redraw cost down to an acceptable range via write-marks-dirty diffing.
  • Cross-provider tool-calling compatibility — native function-calling and text-fallback wire formats had to switch seamlessly inside one ReAct loop while preserving the provenance of tool arguments.
  • Safety bounds for the autonomous loop/pursue has to drive the agent to completion without losing control. We settled on a marker-based stop-gate (no LLM judge) layered with turns/tokens/time budgets and a named terminal_reason.
  • Sharing one agent kernel between coding and quant — the trading path has to satisfy local risk and audit requirements, while the expert council must stay strictly advisory and off the order path; the isolation boundary between them had to be explicit.

Accomplishments that we're proud of

  • We did not reach for ratatui — we built the neenee-tui grid + diff engine, and it stably carries the full agent interaction (status, expandable steps, diffs, modals, overlays).
  • A unified prompt-cache report and policy across four vendors (ADR-0067), making session-level caching no longer an Anthropic-only feature.
  • neenee-quant ships an end-to-end market-data + order loop through the official LongPort SDK, with local risk checks, audit, throttling, and an explicit arming step (ADR-0062).
  • The expert council is a reusable crate: five perspectives + cross-examination
    • independent synthesis, fully decoupled from the order path (ADR-0063).
  • Every design decision is captured via ADRs and four documentation categories; we now have 69 ADRs on file.

What we learned

  • Separate the control plane from the execution plane — the harness owns pursuit, budgets, and safety bounds, while provider calls just send requests; coupling the two makes a correct autonomous loop almost impossible.
  • Degrade rather than abort — keeping the last good result when a signal source fails, or falling back to paper mode on the trading path, makes recoverability more valuable than "correct but brittle."
  • Provenance matters more than content — the two-tier <system-reminder> vs <untrusted_…> trust model (ADR-0068) lets us trace where every injected instruction came from.
  • Lint is part of design — setting unwrap_used / expect_used to warning makes every new unwrap visible in review, which makes the code more disciplined, not less.

What's next for neenee

  • Keep polishing neenee-tui: better table hit-testing, accessibility, and a higher-frame-rate diff path.
  • Expand Pursuits: a richer stop-gate condition language, and coordinated autonomy with the envoy sub-agent.
  • Take the decision-intelligence workbench beyond market signals (structured datasets, PDF prospectuses, research reports).
  • Refine the cross-vendor capability abstraction so that adding a new provider approaches the cost of implementing a single trait.
  • Explore safe autonomous boundaries in unattended mode, so neenee can self-drive for long stretches inside a trusted sandbox.

Built With

  • agent
Share this project:

Updates