@@ -28,7 +28,7 @@ internal/
2828 loop_test.go Engine tests with mock server
2929 session/
3030 session.go Session store (CRUD, trim, cleanup)
31- session_test.go Session tests
31+ session_test.go Session tests (42 tests, 89.7% coverage)
3232 render/
3333 render.go Terminal output with model label and color
3434 resource/
@@ -40,21 +40,24 @@ internal/
4040 tool/
4141 registry.go Thread-safe tool registry
4242 registry_test.go Registry tests
43+ clarify.go Clarify tool — ask user questions with Answer function injection
44+ clarify_test.go Clarify tool tests (11 tests, 100% coverage)
4345 danger/
4446 classifier.go Command/URL classification for security gating
4547 classifier_test.go 209 tests, 8 risk classes, config overrides
4648 approver.go Approver interface + TTYApprover (CLI /dev/tty)
4749 memory/
4850 memory.go MemoryManager orchestrator (facts, buffer, episodes)
51+ merge.go go-vector RP merge-on-write detector
4952 facts.go FactStore with caps, dedup, substring CRUD
5053 buffer.go Ring buffer for turn summaries
51- merge.go go-vector RP merge-on-write detector
5254 episodes.go EpisodeStore with search + LLM ranking
5355 scan.go Security scan (invisible Unicode, injection, credentials)
5456 tool.go memory tool for the agent (6 actions)
55- *_test.go 95 tests across all subsystems
57+ *_test.go 144 tests across all subsystems
5658 skills/
57- types.go Skill/skill manager types, DefaultSkillsConfig
59+ types.go Skill/skill manager types, DefaultSkillsConfig, ValidateSkillName
60+ types_test.go ValidateSkillName tests
5861 loader.go Skill loader + trie trigger index
5962 derive.go Keyword derivation from skill body
6063 trigger.go Trigger matching
@@ -63,7 +66,17 @@ internal/
6366 llm_enhance.go LLM enrichment for learning + curation
6467 importer.go URI import with LLM risk assessment
6568 tools.go Skill CRUD tools (list/view/save/patch/delete/load)
66- *_test.go 106 tests across all subsystems
69+ *_test.go 127 tests across all subsystems (86.3% coverage)
70+ telegram/
71+ bot.go Telegram bot client (getFile, download, sendMessage, sendDocument)
72+ config.go Bot config from environment
73+ poller.go Long-polling update fetcher
74+ handler.go Message dispatcher + command router
75+ commands.go Command handlers (/start, /run, /plan, /sessions, etc.)
76+ session.go Telegram session store (chat → odek session mapping)
77+ plan.go Plan management (Slugify, ListPlans, ReadPlan, DeletePlan, MostRecentPlan)
78+ download.go Media download (voice, photo → file on disk)
79+ *_test.go 409 tests across all subsystems (86.9% coverage)
6780cmd/odek/
6881 main.go CLI entry point, flag parsing, commands, sandbox
6982 main_test.go CLI tests (flag parsing, version, init)
@@ -117,27 +130,28 @@ Zero external test dependencies — tests use `httptest`, `testing`, and the sta
117130
118131| Layer | Runner | Tests | What's tested |
119132| -------| --------| -------| ---------------|
120- | ** Unit** | ` go test ./... ` | 859 + | All 13 packages — config, LLM client, loop, sessions, renderer, tools, WS, resources, memory, skills, danger, security |
133+ | ** Unit** | ` go test ./... ` | 1890 + | All 14 packages — config, LLM client, loop, sessions, renderer, tools, WS, resources, memory, skills, telegram, danger, security, mcp |
121134| ** Contract** | ` go test ./cmd/odek/ ` | 60+ | Sub-agent flag parsing, JSON stdout, exit codes, tool schema, config, serve, shell |
122135| ** E2E** | ` KODE_E2E=true go test -run 'TestE2E_' ` | 16 | Real subprocess spawning, tool→binary pipeline, concurrency, timeouts, custom prompts |
123136
124137### Test coverage
125138
126139| Package | Tests | Focus |
127140| ---------| -------| -------|
128- | ` odek ` | 54 | Config defaults, API key fallback, thinking passthrough, model profiles, AGENTS.md, Close lifecycle |
141+ | ` odek ` | 62 | Config defaults, API key fallback, thinking passthrough, model profiles, AGENTS.md, Close lifecycle, token tracking, Memory() nil-safety |
129142| ` internal/config ` | 19 | Config file loading, env vars, merge chain, var expansion |
130- | ` internal/llm ` | 40 | JSON marshaling, thinking fields, response parsing, usage statistics, SimpleCall |
131- | ` internal/loop ` | 31 | ReAct engine with httptest mock server, context budgeting, skill loader |
132- | ` internal/session ` | 22 | CRUD, trim, cleanup, list, latest, edge cases, path traversal protection |
133- | ` internal/tool ` | 7 | Registry CRUD, lookup, duplicate detection |
134- | ` internal/ws ` | 13 | WebSocket upgrade, framing, ping/pong, large messages |
135- | ` internal/resource ` | 24 | @-reference parsing, file resolution, session resolution, security |
136- | ` internal/render ` | 26 | Terminal output, no-color mode, nil safety, tool call/result rendering |
137- | ` internal/danger ` | 209 | Command classification (8 risk classes), config overrides, allow/denylist |
138- | ` internal/memory ` | 95 | Facts CRUD, buffer ring, episodes, merge detector (go-vector), memory tool, security scan, LLM ranking |
139- | ` internal/skills ` | 106 | Loading, triggers, self-improvement (5 heuristics), curation, LLM-enhanced generation, import, tools |
140- | ` cmd/odek ` | 213 | Flag parsing, init, version, sandbox setup, subagent, serve, security E2E, shell tool danger, browser tool, contract tests |
143+ | ` internal/llm ` | 50 | JSON marshaling, thinking fields, response parsing, usage statistics, SimpleCall |
144+ | ` internal/loop ` | 37 | ReAct engine with httptest mock server, context budgeting, skill loader |
145+ | ` internal/session ` | 42 | CRUD, trim, cleanup, list, latest, fallback scan, corrupt data, path traversal protection, concurrent safety, atomic writes |
146+ | ` internal/tool ` | 17 | Registry CRUD, duplicate detection, ClarifyTool (Name, Description, Schema, Call with all error paths) |
147+ | ` internal/ws ` | 1 | WebSocket constant verification |
148+ | ` internal/resource ` | 45 | @-reference parsing, file resolution, session resolution, security |
149+ | ` internal/render ` | 62 | Terminal output, no-color mode, nil safety, tool call/result rendering |
150+ | ` internal/danger ` | 281 | Command classification (8 risk classes), config overrides, allow/denylist |
151+ | ` internal/memory ` | 144 | Facts CRUD, buffer ring, episodes, merge detector (go-vector), ReplaceEntry, AppendEntry, memory tool, security scan, LLM ranking |
152+ | ` internal/skills ` | 127 | Loading, triggers, self-improvement (5 heuristics), curation, LLM-enhanced generation, import, tools, ValidateSkillName, isPrivateHost, extractRelevantChange |
153+ | ` internal/telegram ` | 409 | Bot client, long-polling, command handlers, session management, plan CRUD, voice/photo download, media dir management |
154+ | ` cmd/odek ` | 441 | Flag parsing, init, version, sandbox setup, subagent, serve, security E2E, shell tool danger, browser tool, contract tests |
141155
142156## Key packages
143157
0 commit comments