export-closedloop-learnings

export-closedloop-learnings is a command for Claude Code from closedloop-ai/claude-plugins. It costs 13 tokens per session (866 once invoked), scanned A, original, Apache-2.0.

A command that moves pending ClosedLoop learnings into a global store shared across projects. It removes exact and near-duplicate entries before saving them.

In plain words
What is it for?
Use it to export pending learnings about agents, workflows, or hooks, merge them into the global file, and clear the processed queue.
Why use it?
Useful learnings can otherwise remain trapped in one project, while repeated exports can create redundant records. This command preserves them in one reusable location without common duplicates.

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 export pending learnings about agents, workflows, or hooks, merge them into the global file, and clear the processed queue.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/closedloop-ai/claude-plugins/export-closedloop-learnings
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 export-closedloop-learnings

README.md
[![agentmods](https://agentmods.dev/badge/commands/closedloop-ai/claude-plugins/export-closedloop-learnings.svg)](https://agentmods.dev/commands/closedloop-ai/claude-plugins/export-closedloop-learnings)
Your own site
<a href="https://agentmods.dev/commands/closedloop-ai/claude-plugins/export-closedloop-learnings"><img src="https://agentmods.dev/badge/commands/closedloop-ai/claude-plugins/export-closedloop-learnings.svg" alt="Measured on agentmods" height="20"></a>
Per session 13 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 866 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.00013 $0.00866
Opus 5 $0.00006 $0.00433
Sonnet 5 $0.00003 $0.00173
Haiku 4.5 $0.00001 $0.00087

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

Security

Grade A, and why

export-closedloop-learnings 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 today.

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/export-closedloop-learnings.md · 96 lines

How it starts

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

Export ClosedLoop Learnings Command

Merges ClosedLoop-specific learnings from the current project into a global learnings store at ~/.closedloop-ai/learnings/closedloop-learnings.json with automatic deduplication.

Purpose

When learnings are captured that improve ClosedLoop itself (agents, workflows, hooks), they should be automatically exported to a global location where they persist across projects. This command handles deduplication to prevent redundant entries.

Process

  1. Read pending closedloop learnings: Load $CLOSEDLOOP_WORKDIR/.learnings/pending-closedloop.json
  2. Read existing global learnings: Load ~/.closedloop-ai/learnings/closedloop-learnings.json (create if missing)
  3. Deduplicate: For each pending learning:
    • If exact trigger match exists → skip (already exists)
    • If 80%+ word overlap on summary → skip (duplicate)
    • Otherwise → add as new learning with unique ID
  4. Merge and write: Append non-duplicate learnings with merged_at timestamp
  5. Clear pending: Remove pending-closedloop.json after successful merge

Input Format

pending-closedloop.json:

{
  "learnings": [
    {
      "id": "L-001",
      "scope": "closedloop",
      "category": "pattern",
      "trigger": "plan-writer error handling",
      "summary": "Plan-writer should validate task dependencies before writing",
      "detail": "Found that missing dependency validation causes plan failures",
      "source_project": "my-project",
      "captured_at": "ISO8601"
    }
  ]
}

Output Format

Global file at ~/.closedloop-ai/learnings/closedloop-learnings.json:

{
  "schema_version": "1.0",
  "last_updated": "ISO8601",
  "learnings": [
    {
      "id": "SL-001",
      "trigger": "plan-writer error handling",
      "summary": "Plan-writer should validate task dependencies before writing",
      "detail": "Found that missing dependency validation causes plan failures",
      "category": "pattern",
      "source_project": "my-project",
      "captured_at": "ISO8601",
      "merged_at": "ISO8601"
    }
  ]
}

Read the full file on GitHub · 96 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. today First seen · 96 lines · 13 tokens per session scan A 8396abf80a52

Subscribe to this mod's changes

export-closedloop-learnings is a command published in the GitHub repository closedloop-ai/claude-plugins (103 stars, last pushed yesterday), licensed Apache-2.0. It adds 13 tokens to every session and 866 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.