This is KlintCode, a Rust-based AI coding agent for air-gapped environments. It uses ratatui for TUI and targets local inference hardware with constrained context windows (64K-128K tokens).
-
Context budget awareness: Local models have limited context (e.g. 64K). All system prompts, conversation history, and tool outputs must fit within 48K usable tokens (8K reserved, 8K for output).
-
Never guess method names: Use the generated local
AGENTS.mdand object-specific assist output before writing TeaQL business code. -
Never read or edit generated library source code: Do not read, search, or modify any generated library source files (e.g., source files inside
rust-lib-core/lib/src/,java-lib-core/, orjava-web-spring-boot/). To understand APIs or verify correctness, strictly rely on compiler output (likecargo check) andcargo teaql assistoutput. You are free to read and edit workspace configuration files (likeCargo.toml) and the application business logic you write. -
Query constraints: Every query using
execute_for_list()orexecute()must be preceded by.purpose("why")and.comment("what"). -
Save constraints: Every save using
.save()or.update()must be preceded by.audit_as("description"). -
Use cargo teaql with --input: Every Rust TeaQL operation must use
cargo teaql --input <model> <command>. -
Version requirement:
cargo-teaqlexactly2.0.11. -
Diagnosing Errors: When running commands (like
cargo run,mvn build, etc.) and checking for errors, NEVER use strict case-sensitive tools likegrep "Error". Compilers and tools often outputerror:,ERROR:,Exception, orFailed. Instead, use case-insensitive searches (e.g.grep -i "error") or pipe the entire output to a file and read it. If a command fails and your search returns nothing, stop blindly retrying with larger context bounds; dump the raw output instead. -
Anti-Hallucination (Strict Copy): When implementing TeaQL logic based on
rust-assist-query,rust-assist-create, orAGENTS.md, you MUST rigidly copy the syntax shown in the example code (e.g.let mut entity = Q::xxx().new_entity(ctx)). Do NOT invent or hallucinate standard Builder patterns (likeE::new_xxx()) based on your prior knowledge of other frameworks. Trust the generated snippet completely and literally. -
Finish Promptly: Once you have run the required validation commands (e.g.
cargo checkorcargo test) and they pass, you MUST immediately call thefinish_tasktool. Do NOT continue to endlessly read files or explore the directory tree.
- Use
anyhow::Resultfor error propagation in application code. - Use
thiserrorfor library-level error types. - Follow standard Rust formatting (
cargo fmt). - Add doc comments for public items.
- Keep modules focused — each file handles one concern.
apps/klintcode-cli/— Headless CLI for batch evaluationapps/klintcode-tui/— Interactive TUI (ratatui)crates/agent-core/— State machine (reducer.rs), events, run controllercrates/pipeline/— Evaluation suite runner (suite.rs), build validation (executor.rs)crates/model-vllm/— LLM client (OpenAI-compatible API)crates/validation/— Multi-level validation enginecrates/context-builder/— Prompt construction and token budgetingcrates/artifact-store/— Run output and artifact management
- Unit tests go in the same file as the code they test.
- Integration tests go in
tests/. - Benchmark suites in
benchmarks/(TOML format). - Run tests with
cargo test.
- Build validation pipeline in
crates/pipeline/src/executor.rs. - State machine transitions in
crates/agent-core/src/reducer.rs. - Follow the autonomous branch evaluation rules from teaql-agent-kit.