goal-stats

goal-stats is a command for Claude Code from closedloop-ai/claude-plugins. It costs 17 tokens per session (588 once invoked), scanned A, original, Apache-2.0.

A reporting command that measures how well goals perform across previous runs. It calculates pass rates, average scores, pattern results, and changes over time.

In plain words
What is it for?
Use it to inspect goal success rates, find patterns linked with good or poor outcomes, and review improvement trends.
Why use it?
Without aggregated results, it is difficult to tell which patterns help and which are associated with failed goals. The report turns run logs into comparisons you can review.

Command for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the self-learning plugin — 2 skills, 6 commands shipped together

Good fit Use it to inspect goal success rates, find patterns linked with good or poor outcomes, and review improvement trends.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/closedloop-ai/claude-plugins/goal-stats
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/closedloop-ai/claude-plugins

Made for: Claude Code.

Or install self-learning, the plugin that ships this one along with the rest of its 2 skills, 6 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for goal-stats

README.md
[![agentmods](https://agentmods.dev/badge/commands/closedloop-ai/claude-plugins/goal-stats/github.svg)](https://agentmods.dev/commands/closedloop-ai/claude-plugins/goal-stats)
Your own site
<a href="https://agentmods.dev/commands/closedloop-ai/claude-plugins/goal-stats"><img src="https://agentmods.dev/badge/commands/closedloop-ai/claude-plugins/goal-stats/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for goal-stats

Your own site · 80×15
<a href="https://agentmods.dev/commands/closedloop-ai/claude-plugins/goal-stats"><img src="https://agentmods.dev/badge/commands/closedloop-ai/claude-plugins/goal-stats.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 17 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 588 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00017 $0.00588
Opus 5 $0.00009 $0.00294
Sonnet 5 $0.00003 $0.00118
Haiku 4.5 $0.00002 $0.00059

Measured yesterday against content hash 696df3ef3fc0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

goal-stats scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/self-learning/commands/goal-stats.md · 75 lines

How it starts

The opening of the file, as written. The whole thing — 75 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Goal Stats Command

Analyzes goal performance by examining runs.log and outcomes.log to compute statistics.

Metrics Computed

  1. Pass Rate: Percentage of runs that achieved the active goal
  2. Average Score: Mean goal score across all evaluated runs
  3. Top Contributing Patterns: Patterns with highest correlation to success
  4. Underperforming Patterns: Patterns with high apply rate but low success rate
  5. Improvement Trends: Score changes over time

Process

  1. Read runs.log for run outcomes. Rows are pipe-delimited: run_id|timestamp|goal|iteration|status[|command|last_session_id]. Treat command and last_session_id as optional append-only fields so legacy rows remain valid.
  2. Read outcomes.log for pattern applications and goal results
  3. Correlate pattern usage with goal success/failure
  4. Calculate aggregate statistics
  5. Identify patterns to review or promote

Output Format

Goal Performance Report: {goal_name}
=====================================

Summary:
  Total Runs: 25
  Pass Rate: 72% (18/25)
  Average Score: 0.68

Top Contributing Patterns:
  1. "auth_flow" - 90% success when applied (10 applications)
  2. "null_check" - 85% success when applied (7 applications)
  3. "api_retry" - 80% success when applied (5 applications)

Patterns to Review [REVIEW]:
  1. "deprecated_api" - 30% success (flagged for review)
  2. "old_pattern" - 25% success (consider removal)

Trends (last 10 runs):
  Score: 0.55 → 0.68 → 0.75 (+36% improvement)
  Pass Rate: 60% → 72% → 80% (+33% improvement)

Recommendations:
  - Pattern "auth_flow" consistently helps - consider promoting to HIGH confidence
  - Pattern "deprecated_api" hurting performance - review or remove

Usage

# View goal stats (invoked via ClosedLoop orchestrator)
# Requires runs.log and outcomes.log to exist

Dependencies

  • runs.log: Contains run metadata with goal outcomes and optional command/session correlation
  • outcomes.log: Contains pattern applications with success tracking
  • goal.yaml: Defines active goal for filtering

Read the full file on GitHub · 75 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 75 lines · 17 tokens per session scan A 696df3ef3fc0

Subscribe to this mod's changes

goal-stats is a command published in the GitHub repository closedloop-ai/claude-plugins (103 stars, last pushed 2d ago), licensed Apache-2.0. It adds 17 tokens to every session and 588 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-07.