std::slop is a C++17 AI coding agent driven by a persistent SQLite ledger for session management and transparency.
- Ledger-Driven: All interactions, tool calls, and system changes are stored in SQLite.
- Dual API: Supports Google Gemini (via API key or OAuth) and OpenAI-compatible APIs (defaults to OpenRouter). Includes optimizations like
--strip_reasoningfor better compatibility with reasoning-enabled models via OpenRouter. - Strategy-Aware Replay: Automatically re-parses historical conversation text when switching models mid-session. Tool calls are isolated by provider to ensure high-fidelity execution and prevent cross-model parsing errors.
- Context Control: Manage memory via group-based rebuild commands.
- Sequential Rolling Window: Maintains narrative coherence through chronological history windowing.
- Historical Context Retrieval: Unique ability for the agent to query its own past history via SQL, allowing it to regain context that has fallen out of the rolling window.
- Self-Managed State: Persistent "Long-term RAM" block (---STATE---) autonomously updated by the LLM.
- Todo-Driven Workflows: Integrated todo management system allowing for sequential execution of tasks via specialized skills.
- Live Code Search: Instant codebase exploration using
git grep(with standardgrepfallback), providing rich context and line numbers without indexing overhead. - Transparent Context: Real-time display of estimated context token counts and structural delimiters (
--- BEGIN HISTORY ---, etc.) to see exactly what the LLM sees. - Enhanced UI: ANSI-colored output for improved readability, featuring distinct headers for assistant responses and tool executions.
- Output Truncation: Smart truncation of tool calls and results to 60 columns to maintain terminal clarity while preserving relevant context.
- Tool Execution: Autonomous local file system and shell operations.
- Readline Support: Command history and line auto-completion.
- Skills System: Inject specialized personas and instructions into the session.
- Storage: SQLite3 (Ledger, Tools, Skills, State, Todos).
- Orchestrator: Unified logic for prompt assembly and response processing.
- Execution: Secure tool execution engine.
- Network: Asynchronous HTTP client with automatic exponential backoff for 429/5xx errors.
- C++17 compiler (Clang or GCC).
- Bazel 8.x (Bazelisk recommended).
readlinedevelopment headers.- Git: Git is central to the workflow of
std::slop. The tool has a hard reliance on its features for code exploration, state tracking, and change management. Repositories that usestd::slopmust be valid git repositories.
bazel build //...The project includes hermetic tools for code formatting and linting, managed via Bazel to ensure consistency across environments.
We use clang-format (LLVM 17.0.6) with the Google style guide.
Check formatting:
bazel run //:format.check
# OR
bazel test //:format_testApply formatting:
bazel run //:formatWe use clang-tidy for static analysis. Configuration is in .clang-tidy.
Run linter:
bazel test //:clang_tidy_testA helper script is provided to run all checks:
./scripts/lint.shFor a step-by-step guide, see the WALKTHROUGH.
export GOOGLE_API_KEY="key"
export OPENAI_API_KEY="key"Or use command-line flags: --google_api_key, --openai_api_key. If no keys are provided, the agent will attempt an OAuth login flow for Google Gemini.
bazel run //:std_slop -- [session_name]Caution: This agent can execute shell commands and modify your file system. It is highly recommended to run this project in a sandboxed environment such as bubblewrap or Docker to prevent accidental or malicious damage to your system.
/session listList all unique session names in the DB./session activate <name>Switch to or create a new session./session remove <name>Delete a session and all its data./session clearClear all history and state for current session./undoRemove last interaction and rebuild context./contextShow context status and assembled prompt./context window <N>Set size of rolling window (0 for full history)./window <N>Alias for/context window <N>./context rebuildRebuild session state from conversation history.
/skill listList available skills./skill show <ID>Display details of a skill./tool listList enabled tools./tool show <name>Show tool schema and description.
/todo list [group]List todos (optionally by group)./todo add <group> <desc>Add a new todo to a group./todo edit <group> <id> <desc>Update a todo's description./todo complete <group> <id>Mark a todo as Complete./todo drop <group>Delete all todos in a group.
/modelsList available models from the provider./model <name>Switch the active LLM model./throttle [N]Set or show request throttle (seconds) for agentic loops./exec <command>Run a shell command and view output in a pager./editOpen$EDITORfor multi-line input./stats /usageShow session usage statistics./schemaShow the SQLite database schema.
| Tool | Description |
|---|---|
read_file |
Read local file contents with automatic line numbering. |
write_file |
Create or overwrite local files. |
grep_tool |
Search for patterns with context (delegates to git grep when possible). |
git_grep_tool |
Advanced git-based search with support for branches and history. |
search_code |
Live codebase search using optimized_grep logic. |
execute_bash |
Run arbitrary shell commands. |
query_db |
Query the session ledger using SQL. Used for data analysis and historical context retrieval. |
| Skill | Description |
|---|---|
planner |
Strategic Tech Lead specialized in architectural decomposition and iterative feature delivery. |
dba |
Database Administrator specializing in SQLite schema design and data integrity. |
c++_expert |
Enforces strict adherence to project C++17 constraints (Google Style, no exceptions). |
todo_processor |
Sequential task automation; reads 'Open' todos and executes them upon approval. |
- C++ Standard: C++17.
- Style: Google C++ Style Guide.
- Exceptions: Disabled (-fno-exceptions).
- Memory: RAII and std::unique_ptr exclusively.
- Error Handling: absl::Status and absl::StatusOr.
- Avoid threading and async primitives, if they must be used, use absl based primitives with std::thread. Any threading workflow requires tsan tests.