Skill Intelligence & Benchmarking Architecture¶
Positioning: "Prove that your AI agent skills work through repeatable benchmarks and real execution evidence."
1. Architectural Principles¶
- Zero-Proxy, Local-First Evidence: Operates exclusively on execution transcripts (
tool_calls,security_events,approval_events) already captured by Chakshu's passive adapters (Codex,ClaudeCode,Gemini) and stored in~/.chakshu/chakshu.db. - Never Re-Execute Recorded Commands: Evaluation inspects recorded arguments, outputs, exit codes, durations, token usage, and security telemetry read-only.
- Content-Addressed Skill Revisions: A skill's name never uniquely identifies its version. Revisions are tracked via composite SHA-256 content fingerprints across
SKILL.mdand companion files (scripts/,references/,examples/,resources/). - Windowed Execution Attribution: Not every tool call in a session belongs to a skill. Attribution bounds execution windows from the triggering prompt/skill read until another skill boundary or unrelated turn, assigning explicit confidence scores (
0.0–1.0). - Deterministic Offline Scoring (
chakshu-eval-v1.0): Works 100% offline with deterministic rules and human feedback. Optional LLM-as-a-Judge is disabled by default behind an explicit consent-gated interface. - Separate Security Verdicts: Security findings (
audit.AnalyzeCall,CredentialAccesses) produce an independentSecurityVerdict(CLEAN,WARNING,VIOLATION) and are never blended into quality scores to mask risk. - Immutable Snapshots & Statistical Honesty: Every
EvaluationRunsnapshots the skill fingerprint, profile rules, scenario expectations, and attributed call evidence. Comparisons verify scenario/profile/agent compatibility and never claim statistical significance without sufficient repeated trials (n >= 3).
2. Domain Package Structure¶
internal/
skill/
auditor.go # Skill discovery, frontmatter & companion inspection, SHA-256 fingerprinting, version tracking
store/
evaluation.go # Transactional SQLite persistence & migrations for skill_versions and evaluation_* tables
evaluation/
model.go # Domain models, enums, scoring breakdown, insight & comparison structures
repository.go # Persistence repository interface
attribution.go # Session-to-skill window detection, baseline scoping, and confidence scoring
scorer.go # Deterministic v1.0 scoring engine, dimension weighting, required-rule gating
insights.go # Evidence-linked Skill Improvement Insights & regression diagnosis
service.go # Application service orchestrating discovery, benchmarks, evaluations, comparisons & exports
benchmark/
suite.go # BenchmarkSuite, built-in templates, JSON + stdlib YAML import/export & validation
scenario.go # BenchmarkScenario model & behavioral contract validation
service.go # Suite and scenario lifecycle service
comparison.go # Paired scenario comparison engine, compatibility checks & regression detector
rules/
condition.go # Safe declarative rule condition schema & bounded regex matchers
deterministic.go # Action-level and execution-level deterministic rule evaluators
registry.go # Default profiles, dimensions, and rule validation
evaluator.go # Rule execution runner with evidence fingerprinting (zero double-counting)
human/
evaluator.go # Human feedback validation, reward/penalty deltas & verdict overrides
judge/
interface.go # Extensible Judge interface
llm.go # Disabled-by-default consent-gated LLMJudge adapter
report/
builder.go # Explainable EvaluationReport assembler & structured JSON exporter
ui/
evaluation.go # REST API endpoints for Skill Intelligence & Benchmarking
web/
components/
SkillIntelligenceView.tsx # First-class dashboard (Overview, Skills, Studio, Executions, Comparisons, Profiles, Reports)
3. Scoring Specification (chakshu-eval-v1.0)¶
$$\text{score} = \text{clamp}\left(100 \times \frac{\text{earned_rewards} - \text{penalties}}{\text{applicable_maximum_rewards}}, 0, 100\right)$$
- Non-Applicable Rules (
NOT_APPLICABLE): Excluded fromapplicable_maximum_rewards,earned_rewards, andpenalties. - Unobservable Telemetry (
UNOBSERVABLE): Recorded explicitly when underlying transcript telemetry is absent (e.g., missing token counts or uncaptured outputs); excluded fromapplicable_maximum_rewardsrather than penalized as failures. - Deduplication: Evidence fingerprints
(rule_id, call_id, condition_key)ensure repeated identical matches within an action window never inflate rewards beyond the rule's configured maximum. - Required Rules: Any failed
required: truerule setsrequired_gate_failed = trueand marks the run verdictFAIL. - Unevaluated State: When
applicable_maximum_rewards == 0and no human pass/fail override exists, the run status isUNEVALUATED(score = null).
Default Dimensions¶
task_completioninstruction_adherencetool_correctnessoutput_qualityexecution_efficiencysecurity_compliance(reported as a separate Security Verdict & compliance metric)
4. SQLite Entities¶
skill_versions—Immutable revision records keyed by(skill_id, content_fingerprint)with revision numbers, parsed metadata, instructions, and change summaries.evaluation_profiles— Versioned evaluation configurations.evaluation_dimensions— Weighted scoring dimensions belonging to a profile.evaluation_rules— Versioned deterministic, human, or judge rules with reward/penalty points and severity.evaluation_suites— Benchmark suites with category, tags, target skill, and template metadata.evaluation_scenarios— Individual test scenarios with prompts, required/forbidden actions, and expected outcomes.evaluation_executions— Captured session associations (skillorbaseline) with attributed call IDs and confidence metadata.evaluation_suite_runs— Grouped suite execution batches.evaluation_runs— Immutable evaluation snapshots storing scores, dimension breakdowns, security verdicts, and frozen rule/scenario snapshots.evaluation_action_results— Per-rule and per-action deterministic/judge judgments.evaluation_evidence— Deduplicated evidence links totool_calls.evaluation_feedback— Human evaluation rewards, penalties, verdicts, and reviewer notes.evaluation_judge_config— Opt-in LLM-as-a-Judge configuration (consent flag, local agent CLI or HTTP provider, and write-only API key).
5. REST API (all local, JSON)¶
| Area | Endpoints |
|---|---|
| Overview | GET /api/skill-intel/overview |
| Skills | GET /api/skills (existing, enriched), GET /api/skills/{id}, GET /api/skills/{id}/versions, GET /api/skills/{id}/executions |
| Suites | GET/POST /api/benchmarks/suites, GET/PUT/DELETE /api/benchmarks/suites/{id}, GET /api/benchmarks/suites/{id}/export?format=json\|yaml, POST /api/benchmarks/suites/import, GET /api/benchmarks/templates |
| Scenarios & runs | GET/POST /api/benchmarks/suites/{id}/scenarios, PUT/DELETE /api/benchmarks/scenarios/{id}, GET /api/benchmarks/suites/{id}/runs |
| Executions | GET/POST /api/evaluation/executions (include_candidates=1 lists detected skill windows; evaluate_now: true evaluates inline), POST /api/evaluation/auto-evaluate, GET/DELETE /api/evaluation/executions/{id} |
| Profiles & rules | GET/POST /api/evaluation/profiles, GET/PUT /api/evaluation/profiles/{id}, GET/POST /api/evaluation/profiles/{id}/rules, PUT/DELETE /api/evaluation/rules/{id} |
| Judge (opt-in) | GET/POST /api/evaluation/judge/config, POST /api/evaluation/judge/test |
| Evaluation | GET/POST /api/evaluation/runs (single execution or whole suite; idempotency_key supported), GET /api/evaluation/runs/{id}, POST /api/evaluation/runs/{id}/feedback, GET /api/evaluation/runs/{id}/export |
| Comparison | GET/POST /api/evaluation/compare, GET /api/evaluation/regressions |
6. Implementation Status & Limitations¶
- Evaluation works 100% locally and offline by default (
chakshu-eval-v1.0). The optional LLM-as-a-Judge (internal/evaluation/judge) is disabled by default and requires explicit user consent. When enabled, it supports locally installed agent CLIs (agy,claude,codex,geminivia safeexec.CommandContext) as well as Ollama/OpenAI-compatible, Anthropic, and Gemini HTTP APIs (using environment variables or write-only SQLite keys), receiving only redacted call summaries. - Skill versions are recorded when skills are scanned (
?scan=true/ Rescan). Edits made between scans are not observed, so version matching of an execution uses discovery timestamps (exact_timestamp) or falls back tolatest_known; both are labelled. - Comparisons never claim significance: fewer than 3 trials per paired scenario is reported as
INSUFFICIENT_TRIALS(directional only). No p-values are computed. - Token counts that are not agent-reported are estimated and flagged; missing telemetry is
UNOBSERVABLE, not a failure. - Attribution is heuristic (skill invocation to next prompt / other skill). Confidence is stored; developers can pin a trigger call or select calls explicitly.
- Frontend has no test runner in the repo (adding one requires a new dev dependency, which needs maintainer approval); it is covered by
tsc --noEmitand the production build.