A local-first metrics tool that analyzes how you use AI coding assistants, tracking code changes and generating statistics via MCP protocol
CodeStat defines 2 tools with basic schemas and descriptions, but has critical gaps. Both tools use non-standard naming (RecordBeforeEdit, RecordAfterEdit instead of verb_noun like record_before_edit). Descriptions exist but are generic and lack actionable context for LLM selection. Parameter descriptions are present but lack format constraints, ranges, or validation guidance. No output schema is documented. Error handling is minimal, responses are unstructured dicts with generic 'status'/'message' fields. The tools exhibit a stateful, session-based design (session_id coupling) that forces multi-step orchestration and violates single-responsibility principle. No tool annotations (readOnlyHint, destructiveHint, idempotentHint) despite RecordAfterEdit being destructive (deletes temp data). Security concern: file_path is user-provided with no path traversal validation visible.
Record the complete code content after file editing, extract specific diff lines (added/modified) with line numbers, clean up temporary data, and retain only diff information
Record the complete code content before file editing (temporary local storage, will be cleaned up automatically, no redundant retention)
Non-standard tool naming: 'RecordBeforeEdit' and 'RecordAfterEdit' violate verb_noun convention. Should be 'record_before_edit' and 'record_after_edit' (lowercase, underscores). LLMs parse intent from names, PascalCase names are harder to parse and conflict with class naming conventions.
No output schema documented. Tools return unstructured dicts with generic 'status' and 'message' fields. LLMs cannot plan downstream calls or extract structured data. Should document: success case returns {status: 'success', session_id: string, file_path: string, ...}; error case returns {status: 'error', code: string, message: string, recovery_hint: string}.
Stateful session coupling violates single-responsibility principle. RecordBeforeEdit and RecordAfterEdit are tightly coupled via session_id, agents must call them in strict sequence. This forces multi-step orchestration and breaks idempotency. Consider: (1) merge into single 'record_code_edit' tool accepting before/after code, or (2) make each tool independently useful (e.g., 'analyze_code_diff' that accepts before/after directly without session state).
Inferred effective spec: <=2025-11-25.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | F | 44 | <=2025-11-25 | v2 |
Parameter 'file_path' accepts arbitrary strings with no validation. No path traversal protection visible in source. Agents could pass '../../../etc/passwd' or absolute paths outside intended scope. Add constraint: 'Absolute path within project root; must not contain .. or symlinks. Validated server-side against allowed directories.'
No tool annotations despite destructive operations. RecordAfterEdit deletes temporary data (cleanup). Should declare destructiveHint: true and idempotentHint: false. RecordBeforeEdit is read-only but has no readOnlyHint. Tool annotations enable agents to reason about safety and retry logic.