{"id":"16f07314-1acd-4f28-b9d7-3f19b87e4e94","entityType":"agent","slug":"clawhub-athola-nm-abstract-metacognitive-self-mod","name":"metacognitive-self-mod","canonicalUrl":"https://www.xpersona.co/agent/clawhub-athola-nm-abstract-metacognitive-self-mod","canonicalPath":"/agent/clawhub-athola-nm-abstract-metacognitive-self-mod","generatedAt":"2026-10-10T07:53:04.374Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-10T00:30:56.840Z","emptyReason":null},"description":"Analyze and improve the improvement process. Use for detecting regressions and meta-optimization Skill: metacognitive-self-mod Owner: athola Summary: Analyze and improve the improvement process. Use for detecting regressions and meta-optimization Tags: latest:1.9.19 Version history: v1.9.19 | 2026-08-26T13:03:18.787Z | user Release v1.9.19 v1.9.18 | 2026-08-15T21:27:47.174Z | user Release v1.9.18 v1.9.17 | 2026-07-30T05:27:40.802Z | user Release v1.9.17 v1.9.16 | 2026-07-14T19:44:34.348Z | user Release v1.9.16 v","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1.8K downloads reported by the source. Last updated 10/10/2026.","installCommand":"clawhub skill install s17emme0e2m3cpf7k2jvp3a84984b8z9:nm-abstract-metacognitive-self-mod","sourceUrl":"https://clawhub.ai/athola/nm-abstract-metacognitive-self-mod","homepage":"https://clawhub.ai/athola/skills/nm-abstract-metacognitive-self-mod","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/athola/nm-abstract-metacognitive-self-mod","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/athola/skills/nm-abstract-metacognitive-self-mod","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":41,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Analyze and improve the improvement process. Use for detecting regressions and meta-optimization Skill: metacognitive-self-mod Owner: athola Summary: Analyze an"},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-10T00:30:56.840Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T00:30:56.840Z","emptyReason":null},"stars":null,"forks":null,"downloads":1835,"packageName":null,"latestVersion":"1.9.19","tractionLabel":"1.8K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T00:30:56.840Z","emptyReason":null},"lastUpdatedAt":"2026-10-10T00:30:56.840Z","lastCrawledAt":"2026-10-10T00:30:56.840Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-11T00:30:56.840Z","lastVerifiedAt":null,"highlights":[{"version":"1.9.19","createdAt":"2026-08-26T13:03:18.787Z","changelog":"Release v1.9.19","fileCount":4,"zipByteSize":7675},{"version":"1.9.18","createdAt":"2026-08-15T21:27:47.174Z","changelog":"Release v1.9.18","fileCount":4,"zipByteSize":7601},{"version":"1.9.17","createdAt":"2026-07-30T05:27:40.802Z","changelog":"Release v1.9.17","fileCount":4,"zipByteSize":7543},{"version":"1.9.16","createdAt":"2026-07-14T19:44:34.348Z","changelog":"Release v1.9.16","fileCount":4,"zipByteSize":7778},{"version":"1.9.15","createdAt":"2026-07-04T21:19:12.325Z","changelog":"Release v1.9.15","fileCount":4,"zipByteSize":7789},{"version":"1.9.14","createdAt":"2026-06-30T17:49:47.387Z","changelog":"Release v1.9.14","fileCount":4,"zipByteSize":7675},{"version":"1.9.13","createdAt":"2026-06-27T16:14:25.394Z","changelog":"Release v1.9.13","fileCount":4,"zipByteSize":7702},{"version":"1.9.12","createdAt":"2026-06-19T03:07:30.587Z","changelog":"Release v1.9.12","fileCount":4,"zipByteSize":7732}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s17emme0e2m3cpf7k2jvp3a84984b8z9:nm-abstract-metacognitive-self-mod","setupComplexity":"low","setupSteps":["Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-abstract-metacognitive-self-mod/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-abstract-metacognitive-self-mod/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-abstract-metacognitive-self-mod/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-abstract-metacognitive-self-mod/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-abstract-metacognitive-self-mod/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-abstract-metacognitive-self-mod/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-10T07:53:04.372Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-abstract-metacognitive-self-mod/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-abstract-metacognitive-self-mod/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-abstract-metacognitive-self-mod/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-abstract-metacognitive-self-mod/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-10-10T00:30:56.840Z","emptyReason":null},"readme":"Skill: metacognitive-self-mod\n\nOwner: athola\n\nSummary: Analyze and improve the improvement process. Use for detecting regressions and meta-optimization\n\nTags: latest:1.9.19\n\nVersion history:\n\nv1.9.19 | 2026-08-26T13:03:18.787Z | user\n\nRelease v1.9.19\n\nv1.9.18 | 2026-08-15T21:27:47.174Z | user\n\nRelease v1.9.18\n\nv1.9.17 | 2026-07-30T05:27:40.802Z | user\n\nRelease v1.9.17\n\nv1.9.16 | 2026-07-14T19:44:34.348Z | user\n\nRelease v1.9.16\n\nv1.9.15 | 2026-07-04T21:19:12.325Z | user\n\nRelease v1.9.15\n\nv1.9.14 | 2026-06-30T17:49:47.387Z | user\n\nRelease v1.9.14\n\nv1.9.13 | 2026-06-27T16:14:25.394Z | user\n\nRelease v1.9.13\n\nv1.9.12 | 2026-06-19T03:07:30.587Z | user\n\nRelease v1.9.12\n\nv1.8.6 | 2026-06-07T21:21:41.866Z | user\n\nRelease v1.9.11\n\nv1.8.5 | 2026-05-09T02:14:49.485Z | user\n\nRelease v1.9.5\n\nv1.8.4 | 2026-05-06T14:14:19.089Z | user\n\nRelease v1.9.4\n\nv1.8.3 | 2026-04-10T05:44:47.430Z | user\n\nRelease v1.8.3\n\nv1.8.2 | 2026-04-06T14:17:21.069Z | user\n\nRelease v1.8.2\n\nv1.0.0 | 2026-04-06T05:55:17.667Z | auto\n\n- Initial public release of \"metacognitive-self-mod\" for meta-optimization of skill improvement processes.\n- Automates detection of quality regressions, low effectiveness rates, and degradation despite improvements, triggering deeper analysis.\n- Guides users through analysis of improvement data, extraction of success/failure patterns, and generation of strategy recommendations.\n- Integrates with ImprovementMemory and PerformanceTracker for continuous monitoring and feedback.\n- Outputs actionable, data-driven strategy adjustments to optimize future skill improvements.\n- Designed to support refinement of agent improvement strategies; does not auto-apply changes without user review.\n\nArchive index:\n\nArchive v1.9.19: 4 files, 7675 bytes\n\nFiles: modules/trace-capture.md (6035b), skill-card.md (2048b), SKILL.md (8366b), _meta.json (154b)\n\nFile v1.9.19:SKILL.md\n\n---\nname: metacognitive-self-mod\ndescription: |\n  Analyze and improve the improvement process. Use for detecting regressions and meta-optimization\nversion: 1.9.8\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/abstract\", \"emoji\": \"\\ud83e\\udd9e\"}}\nsource: claude-night-market\nsource_plugin: abstract\n---\n\n> **Night Market Skill** — ported from [claude-night-market/abstract](https://github.com/athola/claude-night-market/tree/master/plugins/abstract). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n# Metacognitive Self-Modification\n\nAnalyze the effectiveness of past skill improvements and\nrefine the improvement process itself. This is the core\ninnovation from the Hyperagents paper: not just improving\nskills, but improving HOW skills are improved.\n\n## Context Triggers (auto-invocation)\n\nThis skill should be invoked automatically when:\n\n1. **Regression detected**: The homeostatic monitor finds\n   a skill's evaluation window ended in\n   `pending_rollback_review` status. The improvement\n   made things worse -- we need to understand why.\n\n2. **Low effectiveness rate**: When\n   `ImprovementMemory.get_effective_strategies()` vs\n   `get_failed_strategies()` shows effectiveness below\n   50%, the improvement process itself needs refinement.\n\n3. **Degradation despite improvements**: When\n   `PerformanceTracker.get_improvement_trend()` returns\n   negative for a skill that was recently improved.\n\n4. **Periodic check**: After every 10 improvement cycles\n   (tracked via outcome count in ImprovementMemory).\n\n### Hook integration\n\nThe homeostatic monitor emits\n`\"improvement_triggered\": true` when a skill crosses the\nflag threshold. At that point, before dispatching the\nskill-improver, check if metacognitive analysis is\nwarranted:\n\n```python\nfrom abstract.improvement_memory import ImprovementMemory\nfrom pathlib import Path\n\nmemory = ImprovementMemory(\n    Path.home() / \".claude/skills/improvement_memory.json\"\n)\n\n# Check if metacognitive analysis is warranted\neffective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\ntotal = len(effective) + len(failed)\n\nneeds_metacognition = False\n\n# Trigger 1: Low effectiveness rate\nif total >= 5 and len(effective) / total < 0.5:\n    needs_metacognition = True\n\n# Trigger 2: Periodic check (every 10 outcomes)\nif total > 0 and total % 10 == 0:\n    needs_metacognition = True\n\n# Trigger 3: Recent regression\nif failed and failed[-1].get(\"outcome_type\") == \"failure\":\n    needs_metacognition = True\n\nif needs_metacognition:\n    # Run metacognitive analysis before next improvement\n    pass  # Skill(abstract:metacognitive-self-mod)\n```\n\n## When To Use (Manual)\n\n- After a batch of skill improvements to assess what\n  worked\n- When improvement outcomes show regressions\n- Periodically (monthly) to refine improvement strategy\n- When the skill-improver agent seems ineffective\n\n## When NOT To Use\n\n- Routine skill improvements (use skill-improver directly)\n- First-time skill creation (use skill-authoring)\n\n## Workflow\n\n### Step 1: Load improvement data\n\nRead improvement memory and performance tracker data:\n\n```bash\n# Check for improvement memory\nMEMORY_FILE=~/.claude/skills/improvement_memory.json\nTRACKER_FILE=~/.claude/skills/performance_history.json\n\nif [ ! -f \"$MEMORY_FILE\" ]; then\n  echo \"No improvement memory found.\"\n  echo \"Run skill-improver first to generate improvement data.\"\n  exit 0\nfi\n```\n\nLoad the JSON files using Python:\n\n```python\nfrom abstract.improvement_memory import ImprovementMemory\nfrom abstract.performance_tracker import PerformanceTracker\nfrom pathlib import Path\n\nmemory = ImprovementMemory(Path.home() / \".claude/skills/improvement_memory.json\")\ntracker = PerformanceTracker(Path.home() / \".claude/skills/performance_history.json\")\n```\n\n### Step 2: Classify improvement outcomes\n\nFor each improvement outcome in memory, classify:\n\n- **Effective**: `after_score - before_score >= 0.1`\n- **Neutral**: `-0.1 < improvement < 0.1`\n- **Regression**: `after_score < before_score`\n\n```python\neffective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\n\n# Calculate effectiveness rate\ntotal = len(effective) + len(failed)\nif total > 0:\n    effectiveness_rate = len(effective) / total\n```\n\n### Step 3: Extract meta-patterns\n\nAnalyze WHAT types of improvements succeed vs fail:\n\n**Success patterns to look for**:\n\n- Adding error handling (reduces failure rate)\n- Adding examples (improves user ratings)\n- Adding quiet/verbose modes (reduces friction)\n- Simplifying workflow steps (reduces duration)\n\n**Failure patterns to look for**:\n\n- Over-engineering (adding too many options)\n- Breaking existing workflows (regression)\n- Adding complexity without validation\n- Token budget overflow from verbose additions\n\nFor each pattern found, record as a causal hypothesis:\n\n```python\nmemory.record_insight(\n    skill_ref=\"_meta\",  # Special ref for meta-insights\n    category=\"causal_hypothesis\",\n    insight=\"Error handling improvements have 85% success rate\",\n    evidence=[\"skill-A v1.1.0: +0.3\", \"skill-B v2.1.0: +0.15\"]\n)\n```\n\n### Step 4: Analyze improvement trends\n\nUse PerformanceTracker to identify:\n\n- Skills with sustained improvement (positive trend)\n- Skills with degradation despite improvement attempts\n- Domains where improvements are most effective\n\n```python\nfor skill_ref in tracker.get_all_skill_refs():\n    trend = tracker.get_improvement_trend(skill_ref)\n    if trend is not None:\n        if trend > 0.05:\n            # Sustained improvement - what's working?\n            pass\n        elif trend < -0.05:\n            # Degrading despite improvements - investigate\n            pass\n```\n\n### Step 5: Generate strategy recommendations\n\nBased on the meta-analysis, generate recommendations for\nthe skill-improver:\n\n1. **Priority formula adjustments**: If certain issue\n   types have higher improvement success rates, weight\n   them higher.\n\n2. **Approach selection**: If \"add error handling\" has 85%\n   success vs \"restructure workflow\" at 30%, bias toward\n   error handling.\n\n3. **Threshold adjustments**: If improvements below\n   priority 3.0 consistently fail, raise the minimum\n   threshold.\n\n4. **Avoidance rules**: Document anti-patterns to avoid\n   in future improvements.\n\n### Step 6: Store meta-insights\n\nRecord all findings back into ImprovementMemory under the\nspecial `_meta` skill ref:\n\n```python\n# Record strategy recommendation\nmemory.record_insight(\n    skill_ref=\"_meta\",\n    category=\"strategy_success\",\n    insight=\"Recommendation: Prioritize error handling and examples over restructuring\",\n    evidence=[f\"Success rate: error_handling={eh_rate:.0%}, restructure={rs_rate:.0%}\"]\n)\n```\n\n### Step 7: Update skill-improver strategy\n\nIf significant meta-insights are found, propose concrete\nmodifications to the skill-improver agent:\n\n- Update priority weights in the priority formula\n- Add avoidance rules for known anti-patterns\n- Adjust thresholds based on empirical data\n- Add new improvement patterns that proved effective\n\n**Important**: Propose changes, do not auto-apply. The user\nmust approve modifications to the improvement process.\n\n## Output\n\n```\nMetacognitive Self-Modification Report\n\nImprovement Data:\n  Total outcomes analyzed: 15\n  Effective improvements: 11 (73%)\n  Regressions: 2 (13%)\n  Neutral: 2 (13%)\n\nSuccess Patterns:\n  1. Error handling additions: 5/6 success (83%)\n  2. Example additions: 3/3 success (100%)\n  3. Quiet mode additions: 2/2 success (100%)\n\nFailure Patterns:\n  1. Workflow restructuring: 1/3 success (33%)\n  2. Token-heavy additions: 0/1 success (0%)\n\nPerformance Trends:\n  Improving: 8 skills (positive trend)\n  Stable: 4 skills (no trend)\n  Degrading: 1 skill (negative trend despite attempts)\n\nRecommendations:\n  1. Weight error handling improvements 2x in priority\n  2. Avoid workflow restructuring below priority 8.0\n  3. Cap additions at 200 tokens to prevent budget overflow\n  4. Focus next improvement cycle on degrading skill X\n\nMeta-insights stored: 5 new entries in improvement memory\n```\n\n## Related\n\n- `abstract:skill-improver` - The agent this skill analyzes\n  and proposes modifications for\n- `abstract:skills-eval` - Evaluation framework whose\n  criteria could be refined by meta-insights\n- `abstract:aggregate-logs` - Data source for improvement\n  metrics\n\nFile v1.9.19:_meta.json\n\n{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-abstract-metacognitive-self-mod\",\n  \"version\": \"1.9.19\",\n  \"publishedAt\": 1787749398787\n}\n\nFile v1.9.19:modules/trace-capture.md\n\n---\nname: trace-capture\ndescription: >-\n  Execution trace recording for continuous\n  learning. Captures tool sequences, decision\n  points, and outcome attribution.\nparent_skill: abstract:metacognitive-self-mod\ncategory: self-improvement\ntags: [traces, execution-recording, attribution, continuous-learning]\ndependencies: [metacognitive-self-mod]\nestimated_tokens: 200\n---\n\n# Execution Trace Capture\n\nRecord execution traces so that metacognitive-self-mod\ncan analyze concrete decision sequences, not just\naggregate metrics. Inspired by Microsoft Trace\n(AutoDiff-like backward propagation through execution\ntraces), Trajectory-Informed Memory Generation (arXiv\n2603.10600, decision attribution from trajectories),\nand the ACE framework (evolving playbooks via\ngeneration, reflection, and curation).\n\n## Trace Structure\n\nEach trace captures a single skill invocation from start\nto finish. The trace body sits inside the shared\nsession-capture envelope (ADR-0011) so friction signals\nand traces can be consumed through one parser:\n\n```json\n{\n  \"schema_version\": \"session-capture/1\",\n  \"session_id\": \"2026-04-14-abc12345\",\n  \"timestamp\": \"2026-04-14T10:30:00Z\",\n  \"source\": \"trace-capture\",\n  \"payload\": {\n    \"trace_id\": \"session-{date}-{hash}\",\n    \"skill\": \"attune:project-execution\",\n    \"started\": \"2026-04-14T10:30:00Z\",\n    \"completed\": \"2026-04-14T10:32:15Z\",\n    \"outcome\": \"success\",\n    \"capture_mode\": \"decision-only\",\n    \"steps\": [\n      {\n        \"tool\": \"Read\",\n        \"target\": \"src/main.py\",\n        \"purpose\": \"understand entry point\",\n        \"result\": \"success\",\n        \"tokens_used\": 1200,\n        \"decision_point\": false\n      },\n      {\n        \"tool\": \"Edit\",\n        \"target\": \"src/main.py:45\",\n        \"purpose\": \"add error handling\",\n        \"result\": \"success\",\n        \"tokens_used\": 800,\n        \"decision_point\": true,\n        \"alternatives_considered\": [\n          \"try/except\",\n          \"result type\",\n          \"assertion\"\n        ],\n        \"rationale\": \"try/except matches existing patterns\"\n      }\n    ],\n    \"attribution\": {\n      \"success_factors\": [\n        \"followed existing patterns\",\n        \"tested incrementally\"\n      ],\n      \"failure_factors\": [],\n      \"key_decisions\": [\n        \"chose try/except over result type at step 4\"\n      ]\n    }\n  }\n}\n```\n\nLegacy traces written before envelope adoption are read\nas ``session-capture/0`` (entire file treated as the\npayload). See ``docs/adr/0011-session-capture-envelope.md``\nfor the contract and migration path.\n\n## Capture Modes\n\nNot every invocation needs a full trace. Three modes\ncontrol the recording fidelity.\n\n| Mode | Records | When to use |\n|------|---------|-------------|\n| `minimal` | Outcome and duration only | High-trust T3 skills |\n| `decision-only` | Decision points, outcome, duration | Default for all skills |\n| `full` | Every tool call, token counts, all fields | Skills with <85% success rate |\n\n**Mode selection logic:**\n\n- Default: `decision-only` (captures rationale without\n  flooding storage).\n- Enable `full` with `--trace=full` or automatically for\n  any skill whose rolling success rate falls below 85%.\n- Use `minimal` for T3 skills that consistently succeed\n  and need only aggregate trend data.\n\n## What to Capture\n\n- **Tool calls** (full mode only): tool name, target,\n  purpose, result, approximate tokens consumed.\n- **Decision points** (all modes except minimal):\n  alternatives considered (2-5), rationale for the\n  chosen option, whether later revised.\n- **Trace completion** (all modes): overall outcome\n  (`success`/`failure`/`partial`), wall-clock duration,\n  total tokens consumed.\n\n## Attribution Analysis\n\nAfter a trace completes, run backward attribution to\nidentify which decisions drove the outcome. This follows\nthe Microsoft Trace principle of propagating feedback\nbackward through the execution path.\n\n**For successful traces:**\n\n1. Identify decisions that aligned with known success\n   patterns (from `improvement_memory.json`).\n2. Flag novel successful patterns as candidate hypotheses.\n3. Record `success_factors` in the trace's `attribution`\n   block.\n\n**For failed traces:**\n\n1. Walk backward from the failure point.\n2. Identify the earliest decision that diverged from\n   known-good patterns.\n3. Record `failure_factors` and the specific decision.\n4. Generate a causal hypothesis for ImprovementMemory:\n\n```python\nmemory.record_insight(\n    skill_ref=trace[\"skill\"],\n    category=\"causal_hypothesis\",\n    insight=\"Failure correlated with choosing X over Y\",\n    evidence=[f\"trace:{trace['trace_id']}\"]\n)\n```\n\n**Cross-trace pattern detection:**\n\nWhen 5 or more traces exist for a skill, scan for\nrecurring decision-outcome correlations:\n\n- Decisions that appear in >70% of successful traces\n  become \"recommended patterns.\"\n- Decisions that appear in >50% of failed traces become\n  \"anti-patterns.\"\n\n## Storage\n\n| Location | Contents | Retention |\n|----------|----------|-----------|\n| `~/.claude/skills/traces/` | Raw JSON trace files | Rolling 30-day window |\n| `improvement_memory.json` | Aggregate patterns and hypotheses | Persistent |\n\n**Budget:** Maximum 100 trace files, FIFO eviction.\nTraces linked to active causal hypotheses are protected\nuntil the hypothesis is resolved. File naming:\n`{trace_id}.json` (one file per trace).\n\n## Integration Points\n\n- **metacognitive-self-mod** (parent): consumes traces\n  during periodic analysis (Step 3) to inspect specific\n  decisions behind success or failure.\n- **skill-improver**: queries traces for a target skill\n  before proposing changes. Targets recurring failure\n  points directly.\n- **friction-detector**: cross-references friction signals\n  with trace data to pinpoint where a workflow broke.\n\n## Lightweight by Default\n\nThe default `decision-only` mode records only branching\npoints (typically 3-8 entries per trace vs 20-50 for\nfull mode). Additional storage hygiene:\n\n- Prune full-mode traces older than 7 days down to\n  decision-only.\n- Cap `alternatives_considered` at 5 entries.\n- Omit `tokens_used` in minimal mode.\n\nFile v1.9.19:skill-card.md\n\n## Description:\n\nAnalyze and improve the improvement process for detecting regressions and meta-optimization.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[athola](https://clawhub.ai/user/athola)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and agent maintainers use this skill to analyze skill-improvement outcomes, detect regressions, extract success and failure patterns, and propose changes to future improvement strategy.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Persistent execution traces and aggregate learning data may retain sensitive paths, project details, tool sequences, or decision rationale.\n\nMitigation: Confirm how trace capture is enabled, redact sensitive paths and project details, and document how traces and persistent memory can be disabled or deleted.\n\nRisk: Generated recommendations could incorrectly alter future skill-improvement behavior if applied without review.\n\nMitigation: Review recommendations and require explicit user approval before modifying the improvement process.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/athola/skills/nm-abstract-metacognitive-self-mod)\n- [Clawdis homepage](https://github.com/athola/claude-night-market/tree/master/plugins/abstract)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown report with inline code and shell command examples]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May propose changes to improvement strategy; artifact guidance says user approval is required before applying modifications.]\n\n## Skill Version(s):\n\n1.9.19 (source: ClawHub release evidence; artifact frontmatter lists 1.9.8)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nArchive v1.9.18: 4 files, 7601 bytes\n\nFiles: modules/trace-capture.md (6035b), skill-card.md (1827b), SKILL.md (8366b), _meta.json (154b)\n\nFile v1.9.18:SKILL.md\n\n---\nname: metacognitive-self-mod\ndescription: |\n  Analyze and improve the improvement process. Use for detecting regressions and meta-optimization\nversion: 1.9.8\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/abstract\", \"emoji\": \"\\ud83e\\udd9e\"}}\nsource: claude-night-market\nsource_plugin: abstract\n---\n\n> **Night Market Skill** — ported from [claude-night-market/abstract](https://github.com/athola/claude-night-market/tree/master/plugins/abstract). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n# Metacognitive Self-Modification\n\nAnalyze the effectiveness of past skill improvements and\nrefine the improvement process itself. This is the core\ninnovation from the Hyperagents paper: not just improving\nskills, but improving HOW skills are improved.\n\n## Context Triggers (auto-invocation)\n\nThis skill should be invoked automatically when:\n\n1. **Regression detected**: The homeostatic monitor finds\n   a skill's evaluation window ended in\n   `pending_rollback_review` status. The improvement\n   made things worse -- we need to understand why.\n\n2. **Low effectiveness rate**: When\n   `ImprovementMemory.get_effective_strategies()` vs\n   `get_failed_strategies()` shows effectiveness below\n   50%, the improvement process itself needs refinement.\n\n3. **Degradation despite improvements**: When\n   `PerformanceTracker.get_improvement_trend()` returns\n   negative for a skill that was recently improved.\n\n4. **Periodic check**: After every 10 improvement cycles\n   (tracked via outcome count in ImprovementMemory).\n\n### Hook integration\n\nThe homeostatic monitor emits\n`\"improvement_triggered\": true` when a skill crosses the\nflag threshold. At that point, before dispatching the\nskill-improver, check if metacognitive analysis is\nwarranted:\n\n```python\nfrom abstract.improvement_memory import ImprovementMemory\nfrom pathlib import Path\n\nmemory = ImprovementMemory(\n    Path.home() / \".claude/skills/improvement_memory.json\"\n)\n\n# Check if metacognitive analysis is warranted\neffective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\ntotal = len(effective) + len(failed)\n\nneeds_metacognition = False\n\n# Trigger 1: Low effectiveness rate\nif total >= 5 and len(effective) / total < 0.5:\n    needs_metacognition = True\n\n# Trigger 2: Periodic check (every 10 outcomes)\nif total > 0 and total % 10 == 0:\n    needs_metacognition = True\n\n# Trigger 3: Recent regression\nif failed and failed[-1].get(\"outcome_type\") == \"failure\":\n    needs_metacognition = True\n\nif needs_metacognition:\n    # Run metacognitive analysis before next improvement\n    pass  # Skill(abstract:metacognitive-self-mod)\n```\n\n## When To Use (Manual)\n\n- After a batch of skill improvements to assess what\n  worked\n- When improvement outcomes show regressions\n- Periodically (monthly) to refine improvement strategy\n- When the skill-improver agent seems ineffective\n\n## When NOT To Use\n\n- Routine skill improvements (use skill-improver directly)\n- First-time skill creation (use skill-authoring)\n\n## Workflow\n\n### Step 1: Load improvement data\n\nRead improvement memory and performance tracker data:\n\n```bash\n# Check for improvement memory\nMEMORY_FILE=~/.claude/skills/improvement_memory.json\nTRACKER_FILE=~/.claude/skills/performance_history.json\n\nif [ ! -f \"$MEMORY_FILE\" ]; then\n  echo \"No improvement memory found.\"\n  echo \"Run skill-improver first to generate improvement data.\"\n  exit 0\nfi\n```\n\nLoad the JSON files using Python:\n\n```python\nfrom abstract.improvement_memory import ImprovementMemory\nfrom abstract.performance_tracker import PerformanceTracker\nfrom pathlib import Path\n\nmemory = ImprovementMemory(Path.home() / \".claude/skills/improvement_memory.json\")\ntracker = PerformanceTracker(Path.home() / \".claude/skills/performance_history.json\")\n```\n\n### Step 2: Classify improvement outcomes\n\nFor each improvement outcome in memory, classify:\n\n- **Effective**: `after_score - before_score >= 0.1`\n- **Neutral**: `-0.1 < improvement < 0.1`\n- **Regression**: `after_score < before_score`\n\n```python\neffective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\n\n# Calculate effectiveness rate\ntotal = len(effective) + len(failed)\nif total > 0:\n    effectiveness_rate = len(effective) / total\n```\n\n### Step 3: Extract meta-patterns\n\nAnalyze WHAT types of improvements succeed vs fail:\n\n**Success patterns to look for**:\n\n- Adding error handling (reduces failure rate)\n- Adding examples (improves user ratings)\n- Adding quiet/verbose modes (reduces friction)\n- Simplifying workflow steps (reduces duration)\n\n**Failure patterns to look for**:\n\n- Over-engineering (adding too many options)\n- Breaking existing workflows (regression)\n- Adding complexity without validation\n- Token budget overflow from verbose additions\n\nFor each pattern found, record as a causal hypothesis:\n\n```python\nmemory.record_insight(\n    skill_ref=\"_meta\",  # Special ref for meta-insights\n    category=\"causal_hypothesis\",\n    insight=\"Error handling improvements have 85% success rate\",\n    evidence=[\"skill-A v1.1.0: +0.3\", \"skill-B v2.1.0: +0.15\"]\n)\n```\n\n### Step 4: Analyze improvement trends\n\nUse PerformanceTracker to identify:\n\n- Skills with sustained improvement (positive trend)\n- Skills with degradation despite improvement attempts\n- Domains where improvements are most effective\n\n```python\nfor skill_ref in tracker.get_all_skill_refs():\n    trend = tracker.get_improvement_trend(skill_ref)\n    if trend is not None:\n        if trend > 0.05:\n            # Sustained improvement - what's working?\n            pass\n        elif trend < -0.05:\n            # Degrading despite improvements - investigate\n            pass\n```\n\n### Step 5: Generate strategy recommendations\n\nBased on the meta-analysis, generate recommendations for\nthe skill-improver:\n\n1. **Priority formula adjustments**: If certain issue\n   types have higher improvement success rates, weight\n   them higher.\n\n2. **Approach selection**: If \"add error handling\" has 85%\n   success vs \"restructure workflow\" at 30%, bias toward\n   error handling.\n\n3. **Threshold adjustments**: If improvements below\n   priority 3.0 consistently fail, raise the minimum\n   threshold.\n\n4. **Avoidance rules**: Document anti-patterns to avoid\n   in future improvements.\n\n### Step 6: Store meta-insights\n\nRecord all findings back into ImprovementMemory under the\nspecial `_meta` skill ref:\n\n```python\n# Record strategy recommendation\nmemory.record_insight(\n    skill_ref=\"_meta\",\n    category=\"strategy_success\",\n    insight=\"Recommendation: Prioritize error handling and examples over restructuring\",\n    evidence=[f\"Success rate: error_handling={eh_rate:.0%}, restructure={rs_rate:.0%}\"]\n)\n```\n\n### Step 7: Update skill-improver strategy\n\nIf significant meta-insights are found, propose concrete\nmodifications to the skill-improver agent:\n\n- Update priority weights in the priority formula\n- Add avoidance rules for known anti-patterns\n- Adjust thresholds based on empirical data\n- Add new improvement patterns that proved effective\n\n**Important**: Propose changes, do not auto-apply. The user\nmust approve modifications to the improvement process.\n\n## Output\n\n```\nMetacognitive Self-Modification Report\n\nImprovement Data:\n  Total outcomes analyzed: 15\n  Effective improvements: 11 (73%)\n  Regressions: 2 (13%)\n  Neutral: 2 (13%)\n\nSuccess Patterns:\n  1. Error handling additions: 5/6 success (83%)\n  2. Example additions: 3/3 success (100%)\n  3. Quiet mode additions: 2/2 success (100%)\n\nFailure Patterns:\n  1. Workflow restructuring: 1/3 success (33%)\n  2. Token-heavy additions: 0/1 success (0%)\n\nPerformance Trends:\n  Improving: 8 skills (positive trend)\n  Stable: 4 skills (no trend)\n  Degrading: 1 skill (negative trend despite attempts)\n\nRecommendations:\n  1. Weight error handling improvements 2x in priority\n  2. Avoid workflow restructuring below priority 8.0\n  3. Cap additions at 200 tokens to prevent budget overflow\n  4. Focus next improvement cycle on degrading skill X\n\nMeta-insights stored: 5 new entries in improvement memory\n```\n\n## Related\n\n- `abstract:skill-improver` - The agent this skill analyzes\n  and proposes modifications for\n- `abstract:skills-eval` - Evaluation framework whose\n  criteria could be refined by meta-insights\n- `abstract:aggregate-logs` - Data source for improvement\n  metrics\n\nFile v1.9.18:_meta.json\n\n{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-abstract-metacognitive-self-mod\",\n  \"version\": \"1.9.18\",\n  \"publishedAt\": 1786829267174\n}\n\nFile v1.9.18:modules/trace-capture.md\n\n---\nname: trace-capture\ndescription: >-\n  Execution trace recording for continuous\n  learning. Captures tool sequences, decision\n  points, and outcome attribution.\nparent_skill: abstract:metacognitive-self-mod\ncategory: self-improvement\ntags: [traces, execution-recording, attribution, continuous-learning]\ndependencies: [metacognitive-self-mod]\nestimated_tokens: 200\n---\n\n# Execution Trace Capture\n\nRecord execution traces so that metacognitive-self-mod\ncan analyze concrete decision sequences, not just\naggregate metrics. Inspired by Microsoft Trace\n(AutoDiff-like backward propagation through execution\ntraces), Trajectory-Informed Memory Generation (arXiv\n2603.10600, decision attribution from trajectories),\nand the ACE framework (evolving playbooks via\ngeneration, reflection, and curation).\n\n## Trace Structure\n\nEach trace captures a single skill invocation from start\nto finish. The trace body sits inside the shared\nsession-capture envelope (ADR-0011) so friction signals\nand traces can be consumed through one parser:\n\n```json\n{\n  \"schema_version\": \"session-capture/1\",\n  \"session_id\": \"2026-04-14-abc12345\",\n  \"timestamp\": \"2026-04-14T10:30:00Z\",\n  \"source\": \"trace-capture\",\n  \"payload\": {\n    \"trace_id\": \"session-{date}-{hash}\",\n    \"skill\": \"attune:project-execution\",\n    \"started\": \"2026-04-14T10:30:00Z\",\n    \"completed\": \"2026-04-14T10:32:15Z\",\n    \"outcome\": \"success\",\n    \"capture_mode\": \"decision-only\",\n    \"steps\": [\n      {\n        \"tool\": \"Read\",\n        \"target\": \"src/main.py\",\n        \"purpose\": \"understand entry point\",\n        \"result\": \"success\",\n        \"tokens_used\": 1200,\n        \"decision_point\": false\n      },\n      {\n        \"tool\": \"Edit\",\n        \"target\": \"src/main.py:45\",\n        \"purpose\": \"add error handling\",\n        \"result\": \"success\",\n        \"tokens_used\": 800,\n        \"decision_point\": true,\n        \"alternatives_considered\": [\n          \"try/except\",\n          \"result type\",\n          \"assertion\"\n        ],\n        \"rationale\": \"try/except matches existing patterns\"\n      }\n    ],\n    \"attribution\": {\n      \"success_factors\": [\n        \"followed existing patterns\",\n        \"tested incrementally\"\n      ],\n      \"failure_factors\": [],\n      \"key_decisions\": [\n        \"chose try/except over result type at step 4\"\n      ]\n    }\n  }\n}\n```\n\nLegacy traces written before envelope adoption are read\nas ``session-capture/0`` (entire file treated as the\npayload). See ``docs/adr/0011-session-capture-envelope.md``\nfor the contract and migration path.\n\n## Capture Modes\n\nNot every invocation needs a full trace. Three modes\ncontrol the recording fidelity.\n\n| Mode | Records | When to use |\n|------|---------|-------------|\n| `minimal` | Outcome and duration only | High-trust T3 skills |\n| `decision-only` | Decision points, outcome, duration | Default for all skills |\n| `full` | Every tool call, token counts, all fields | Skills with <85% success rate |\n\n**Mode selection logic:**\n\n- Default: `decision-only` (captures rationale without\n  flooding storage).\n- Enable `full` with `--trace=full` or automatically for\n  any skill whose rolling success rate falls below 85%.\n- Use `minimal` for T3 skills that consistently succeed\n  and need only aggregate trend data.\n\n## What to Capture\n\n- **Tool calls** (full mode only): tool name, target,\n  purpose, result, approximate tokens consumed.\n- **Decision points** (all modes except minimal):\n  alternatives considered (2-5), rationale for the\n  chosen option, whether later revised.\n- **Trace completion** (all modes): overall outcome\n  (`success`/`failure`/`partial`), wall-clock duration,\n  total tokens consumed.\n\n## Attribution Analysis\n\nAfter a trace completes, run backward attribution to\nidentify which decisions drove the outcome. This follows\nthe Microsoft Trace principle of propagating feedback\nbackward through the execution path.\n\n**For successful traces:**\n\n1. Identify decisions that aligned with known success\n   patterns (from `improvement_memory.json`).\n2. Flag novel successful patterns as candidate hypotheses.\n3. Record `success_factors` in the trace's `attribution`\n   block.\n\n**For failed traces:**\n\n1. Walk backward from the failure point.\n2. Identify the earliest decision that diverged from\n   known-good patterns.\n3. Record `failure_factors` and the specific decision.\n4. Generate a causal hypothesis for ImprovementMemory:\n\n```python\nmemory.record_insight(\n    skill_ref=trace[\"skill\"],\n    category=\"causal_hypothesis\",\n    insight=\"Failure correlated with choosing X over Y\",\n    evidence=[f\"trace:{trace['trace_id']}\"]\n)\n```\n\n**Cross-trace pattern detection:**\n\nWhen 5 or more traces exist for a skill, scan for\nrecurring decision-outcome correlations:\n\n- Decisions that appear in >70% of successful traces\n  become \"recommended patterns.\"\n- Decisions that appear in >50% of failed traces become\n  \"anti-patterns.\"\n\n## Storage\n\n| Location | Contents | Retention |\n|----------|----------|-----------|\n| `~/.claude/skills/traces/` | Raw JSON trace files | Rolling 30-day window |\n| `improvement_memory.json` | Aggregate patterns and hypotheses | Persistent |\n\n**Budget:** Maximum 100 trace files, FIFO eviction.\nTraces linked to active causal hypotheses are protected\nuntil the hypothesis is resolved. File naming:\n`{trace_id}.json` (one file per trace).\n\n## Integration Points\n\n- **metacognitive-self-mod** (parent): consumes traces\n  during periodic analysis (Step 3) to inspect specific\n  decisions behind success or failure.\n- **skill-improver**: queries traces for a target skill\n  before proposing changes. Targets recurring failure\n  points directly.\n- **friction-detector**: cross-references friction signals\n  with trace data to pinpoint where a workflow broke.\n\n## Lightweight by Default\n\nThe default `decision-only` mode records only branching\npoints (typically 3-8 entries per trace vs 20-50 for\nfull mode). Additional storage hygiene:\n\n- Prune full-mode traces older than 7 days down to\n  decision-only.\n- Cap `alternatives_considered` at 5 entries.\n- Omit `tokens_used` in minimal mode.\n\nFile v1.9.18:skill-card.md\n\n## Description:\n\nAnalyze and improve the improvement process for detecting regressions and meta-optimization.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[athola](https://clawhub.ai/user/athola)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and engineers use this skill to review prior skill-improvement outcomes, identify patterns behind regressions or effective changes, and propose refinements to future improvement strategy.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill records and reuses persistent behavioral traces and improvement insights with limited user control or sanitization.\n\nMitigation: Limit trace mode, exclude sensitive projects, periodically delete local trace and improvement-memory entries, and require explicit approval before meta-insights are written or reused.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/athola/skills/nm-abstract-metacognitive-self-mod)\n- [Project homepage from ClawHub metadata](https://github.com/athola/claude-night-market/tree/master/plugins/abstract)\n\n## Skill Output:\n\n**Output Type(s):** [Analysis, Markdown, Guidance, Configuration]\n\n**Output Format:** [Markdown report with recommendations and optional code or shell command snippets]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May record meta-insights in local improvement memory and proposes, but does not auto-apply, changes to the improvement process.]\n\n## Skill Version(s):\n\n1.9.18 (source: ClawHub release evidence)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nArchive v1.9.17: 4 files, 7543 bytes\n\nFiles: modules/trace-capture.md (6035b), skill-card.md (1757b), SKILL.md (8366b), _meta.json (154b)\n\nFile v1.9.17:SKILL.md\n\n---\nname: metacognitive-self-mod\ndescription: |\n  Analyze and improve the improvement process. Use for detecting regressions and meta-optimization\nversion: 1.9.8\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/abstract\", \"emoji\": \"\\ud83e\\udd9e\"}}\nsource: claude-night-market\nsource_plugin: abstract\n---\n\n> **Night Market Skill** — ported from [claude-night-market/abstract](https://github.com/athola/claude-night-market/tree/master/plugins/abstract). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n# Metacognitive Self-Modification\n\nAnalyze the effectiveness of past skill improvements and\nrefine the improvement process itself. This is the core\ninnovation from the Hyperagents paper: not just improving\nskills, but improving HOW skills are improved.\n\n## Context Triggers (auto-invocation)\n\nThis skill should be invoked automatically when:\n\n1. **Regression detected**: The homeostatic monitor finds\n   a skill's evaluation window ended in\n   `pending_rollback_review` status. The improvement\n   made things worse -- we need to understand why.\n\n2. **Low effectiveness rate**: When\n   `ImprovementMemory.get_effective_strategies()` vs\n   `get_failed_strategies()` shows effectiveness below\n   50%, the improvement process itself needs refinement.\n\n3. **Degradation despite improvements**: When\n   `PerformanceTracker.get_improvement_trend()` returns\n   negative for a skill that was recently improved.\n\n4. **Periodic check**: After every 10 improvement cycles\n   (tracked via outcome count in ImprovementMemory).\n\n### Hook integration\n\nThe homeostatic monitor emits\n`\"improvement_triggered\": true` when a skill crosses the\nflag threshold. At that point, before dispatching the\nskill-improver, check if metacognitive analysis is\nwarranted:\n\n```python\nfrom abstract.improvement_memory import ImprovementMemory\nfrom pathlib import Path\n\nmemory = ImprovementMemory(\n    Path.home() / \".claude/skills/improvement_memory.json\"\n)\n\n# Check if metacognitive analysis is warranted\neffective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\ntotal = len(effective) + len(failed)\n\nneeds_metacognition = False\n\n# Trigger 1: Low effectiveness rate\nif total >= 5 and len(effective) / total < 0.5:\n    needs_metacognition = True\n\n# Trigger 2: Periodic check (every 10 outcomes)\nif total > 0 and total % 10 == 0:\n    needs_metacognition = True\n\n# Trigger 3: Recent regression\nif failed and failed[-1].get(\"outcome_type\") == \"failure\":\n    needs_metacognition = True\n\nif needs_metacognition:\n    # Run metacognitive analysis before next improvement\n    pass  # Skill(abstract:metacognitive-self-mod)\n```\n\n## When To Use (Manual)\n\n- After a batch of skill improvements to assess what\n  worked\n- When improvement outcomes show regressions\n- Periodically (monthly) to refine improvement strategy\n- When the skill-improver agent seems ineffective\n\n## When NOT To Use\n\n- Routine skill improvements (use skill-improver directly)\n- First-time skill creation (use skill-authoring)\n\n## Workflow\n\n### Step 1: Load improvement data\n\nRead improvement memory and performance tracker data:\n\n```bash\n# Check for improvement memory\nMEMORY_FILE=~/.claude/skills/improvement_memory.json\nTRACKER_FILE=~/.claude/skills/performance_history.json\n\nif [ ! -f \"$MEMORY_FILE\" ]; then\n  echo \"No improvement memory found.\"\n  echo \"Run skill-improver first to generate improvement data.\"\n  exit 0\nfi\n```\n\nLoad the JSON files using Python:\n\n```python\nfrom abstract.improvement_memory import ImprovementMemory\nfrom abstract.performance_tracker import PerformanceTracker\nfrom pathlib import Path\n\nmemory = ImprovementMemory(Path.home() / \".claude/skills/improvement_memory.json\")\ntracker = PerformanceTracker(Path.home() / \".claude/skills/performance_history.json\")\n```\n\n### Step 2: Classify improvement outcomes\n\nFor each improvement outcome in memory, classify:\n\n- **Effective**: `after_score - before_score >= 0.1`\n- **Neutral**: `-0.1 < improvement < 0.1`\n- **Regression**: `after_score < before_score`\n\n```python\neffective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\n\n# Calculate effectiveness rate\ntotal = len(effective) + len(failed)\nif total > 0:\n    effectiveness_rate = len(effective) / total\n```\n\n### Step 3: Extract meta-patterns\n\nAnalyze WHAT types of improvements succeed vs fail:\n\n**Success patterns to look for**:\n\n- Adding error handling (reduces failure rate)\n- Adding examples (improves user ratings)\n- Adding quiet/verbose modes (reduces friction)\n- Simplifying workflow steps (reduces duration)\n\n**Failure patterns to look for**:\n\n- Over-engineering (adding too many options)\n- Breaking existing workflows (regression)\n- Adding complexity without validation\n- Token budget overflow from verbose additions\n\nFor each pattern found, record as a causal hypothesis:\n\n```python\nmemory.record_insight(\n    skill_ref=\"_meta\",  # Special ref for meta-insights\n    category=\"causal_hypothesis\",\n    insight=\"Error handling improvements have 85% success rate\",\n    evidence=[\"skill-A v1.1.0: +0.3\", \"skill-B v2.1.0: +0.15\"]\n)\n```\n\n### Step 4: Analyze improvement trends\n\nUse PerformanceTracker to identify:\n\n- Skills with sustained improvement (positive trend)\n- Skills with degradation despite improvement attempts\n- Domains where improvements are most effective\n\n```python\nfor skill_ref in tracker.get_all_skill_refs():\n    trend = tracker.get_improvement_trend(skill_ref)\n    if trend is not None:\n        if trend > 0.05:\n            # Sustained improvement - what's working?\n            pass\n        elif trend < -0.05:\n            # Degrading despite improvements - investigate\n            pass\n```\n\n### Step 5: Generate strategy recommendations\n\nBased on the meta-analysis, generate recommendations for\nthe skill-improver:\n\n1. **Priority formula adjustments**: If certain issue\n   types have higher improvement success rates, weight\n   them higher.\n\n2. **Approach selection**: If \"add error handling\" has 85%\n   success vs \"restructure workflow\" at 30%, bias toward\n   error handling.\n\n3. **Threshold adjustments**: If improvements below\n   priority 3.0 consistently fail, raise the minimum\n   threshold.\n\n4. **Avoidance rules**: Document anti-patterns to avoid\n   in future improvements.\n\n### Step 6: Store meta-insights\n\nRecord all findings back into ImprovementMemory under the\nspecial `_meta` skill ref:\n\n```python\n# Record strategy recommendation\nmemory.record_insight(\n    skill_ref=\"_meta\",\n    category=\"strategy_success\",\n    insight=\"Recommendation: Prioritize error handling and examples over restructuring\",\n    evidence=[f\"Success rate: error_handling={eh_rate:.0%}, restructure={rs_rate:.0%}\"]\n)\n```\n\n### Step 7: Update skill-improver strategy\n\nIf significant meta-insights are found, propose concrete\nmodifications to the skill-improver agent:\n\n- Update priority weights in the priority formula\n- Add avoidance rules for known anti-patterns\n- Adjust thresholds based on empirical data\n- Add new improvement patterns that proved effective\n\n**Important**: Propose changes, do not auto-apply. The user\nmust approve modifications to the improvement process.\n\n## Output\n\n```\nMetacognitive Self-Modification Report\n\nImprovement Data:\n  Total outcomes analyzed: 15\n  Effective improvements: 11 (73%)\n  Regressions: 2 (13%)\n  Neutral: 2 (13%)\n\nSuccess Patterns:\n  1. Error handling additions: 5/6 success (83%)\n  2. Example additions: 3/3 success (100%)\n  3. Quiet mode additions: 2/2 success (100%)\n\nFailure Patterns:\n  1. Workflow restructuring: 1/3 success (33%)\n  2. Token-heavy additions: 0/1 success (0%)\n\nPerformance Trends:\n  Improving: 8 skills (positive trend)\n  Stable: 4 skills (no trend)\n  Degrading: 1 skill (negative trend despite attempts)\n\nRecommendations:\n  1. Weight error handling improvements 2x in priority\n  2. Avoid workflow restructuring below priority 8.0\n  3. Cap additions at 200 tokens to prevent budget overflow\n  4. Focus next improvement cycle on degrading skill X\n\nMeta-insights stored: 5 new entries in improvement memory\n```\n\n## Related\n\n- `abstract:skill-improver` - The agent this skill analyzes\n  and proposes modifications for\n- `abstract:skills-eval` - Evaluation framework whose\n  criteria could be refined by meta-insights\n- `abstract:aggregate-logs` - Data source for improvement\n  metrics\n\nFile v1.9.17:_meta.json\n\n{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-abstract-metacognitive-self-mod\",\n  \"version\": \"1.9.17\",\n  \"publishedAt\": 1785389260802\n}\n\nFile v1.9.17:modules/trace-capture.md\n\n---\nname: trace-capture\ndescription: >-\n  Execution trace recording for continuous\n  learning. Captures tool sequences, decision\n  points, and outcome attribution.\nparent_skill: abstract:metacognitive-self-mod\ncategory: self-improvement\ntags: [traces, execution-recording, attribution, continuous-learning]\ndependencies: [metacognitive-self-mod]\nestimated_tokens: 200\n---\n\n# Execution Trace Capture\n\nRecord execution traces so that metacognitive-self-mod\ncan analyze concrete decision sequences, not just\naggregate metrics. Inspired by Microsoft Trace\n(AutoDiff-like backward propagation through execution\ntraces), Trajectory-Informed Memory Generation (arXiv\n2603.10600, decision attribution from trajectories),\nand the ACE framework (evolving playbooks via\ngeneration, reflection, and curation).\n\n## Trace Structure\n\nEach trace captures a single skill invocation from start\nto finish. The trace body sits inside the shared\nsession-capture envelope (ADR-0011) so friction signals\nand traces can be consumed through one parser:\n\n```json\n{\n  \"schema_version\": \"session-capture/1\",\n  \"session_id\": \"2026-04-14-abc12345\",\n  \"timestamp\": \"2026-04-14T10:30:00Z\",\n  \"source\": \"trace-capture\",\n  \"payload\": {\n    \"trace_id\": \"session-{date}-{hash}\",\n    \"skill\": \"attune:project-execution\",\n    \"started\": \"2026-04-14T10:30:00Z\",\n    \"completed\": \"2026-04-14T10:32:15Z\",\n    \"outcome\": \"success\",\n    \"capture_mode\": \"decision-only\",\n    \"steps\": [\n      {\n        \"tool\": \"Read\",\n        \"target\": \"src/main.py\",\n        \"purpose\": \"understand entry point\",\n        \"result\": \"success\",\n        \"tokens_used\": 1200,\n        \"decision_point\": false\n      },\n      {\n        \"tool\": \"Edit\",\n        \"target\": \"src/main.py:45\",\n        \"purpose\": \"add error handling\",\n        \"result\": \"success\",\n        \"tokens_used\": 800,\n        \"decision_point\": true,\n        \"alternatives_considered\": [\n          \"try/except\",\n          \"result type\",\n          \"assertion\"\n        ],\n        \"rationale\": \"try/except matches existing patterns\"\n      }\n    ],\n    \"attribution\": {\n      \"success_factors\": [\n        \"followed existing patterns\",\n        \"tested incrementally\"\n      ],\n      \"failure_factors\": [],\n      \"key_decisions\": [\n        \"chose try/except over result type at step 4\"\n      ]\n    }\n  }\n}\n```\n\nLegacy traces written before envelope adoption are read\nas ``session-capture/0`` (entire file treated as the\npayload). See ``docs/adr/0011-session-capture-envelope.md``\nfor the contract and migration path.\n\n## Capture Modes\n\nNot every invocation needs a full trace. Three modes\ncontrol the recording fidelity.\n\n| Mode | Records | When to use |\n|------|---------|-------------|\n| `minimal` | Outcome and duration only | High-trust T3 skills |\n| `decision-only` | Decision points, outcome, duration | Default for all skills |\n| `full` | Every tool call, token counts, all fields | Skills with <85% success rate |\n\n**Mode selection logic:**\n\n- Default: `decision-only` (captures rationale without\n  flooding storage).\n- Enable `full` with `--trace=full` or automatically for\n  any skill whose rolling success rate falls below 85%.\n- Use `minimal` for T3 skills that consistently succeed\n  and need only aggregate trend data.\n\n## What to Capture\n\n- **Tool calls** (full mode only): tool name, target,\n  purpose, result, approximate tokens consumed.\n- **Decision points** (all modes except minimal):\n  alternatives considered (2-5), rationale for the\n  chosen option, whether later revised.\n- **Trace completion** (all modes): overall outcome\n  (`success`/`failure`/`partial`), wall-clock duration,\n  total tokens consumed.\n\n## Attribution Analysis\n\nAfter a trace completes, run backward attribution to\nidentify which decisions drove the outcome. This follows\nthe Microsoft Trace principle of propagating feedback\nbackward through the execution path.\n\n**For successful traces:**\n\n1. Identify decisions that aligned with known success\n   patterns (from `improvement_memory.json`).\n2. Flag novel successful patterns as candidate hypotheses.\n3. Record `success_factors` in the trace's `attribution`\n   block.\n\n**For failed traces:**\n\n1. Walk backward from the failure point.\n2. Identify the earliest decision that diverged from\n   known-good patterns.\n3. Record `failure_factors` and the specific decision.\n4. Generate a causal hypothesis for ImprovementMemory:\n\n```python\nmemory.record_insight(\n    skill_ref=trace[\"skill\"],\n    category=\"causal_hypothesis\",\n    insight=\"Failure correlated with choosing X over Y\",\n    evidence=[f\"trace:{trace['trace_id']}\"]\n)\n```\n\n**Cross-trace pattern detection:**\n\nWhen 5 or more traces exist for a skill, scan for\nrecurring decision-outcome correlations:\n\n- Decisions that appear in >70% of successful traces\n  become \"recommended patterns.\"\n- Decisions that appear in >50% of failed traces become\n  \"anti-patterns.\"\n\n## Storage\n\n| Location | Contents | Retention |\n|----------|----------|-----------|\n| `~/.claude/skills/traces/` | Raw JSON trace files | Rolling 30-day window |\n| `improvement_memory.json` | Aggregate patterns and hypotheses | Persistent |\n\n**Budget:** Maximum 100 trace files, FIFO eviction.\nTraces linked to active causal hypotheses are protected\nuntil the hypothesis is resolved. File naming:\n`{trace_id}.json` (one file per trace).\n\n## Integration Points\n\n- **metacognitive-self-mod** (parent): consumes traces\n  during periodic analysis (Step 3) to inspect specific\n  decisions behind success or failure.\n- **skill-improver**: queries traces for a target skill\n  before proposing changes. Targets recurring failure\n  points directly.\n- **friction-detector**: cross-references friction signals\n  with trace data to pinpoint where a workflow broke.\n\n## Lightweight by Default\n\nThe default `decision-only` mode records only branching\npoints (typically 3-8 entries per trace vs 20-50 for\nfull mode). Additional storage hygiene:\n\n- Prune full-mode traces older than 7 days down to\n  decision-only.\n- Cap `alternatives_considered` at 5 entries.\n- Omit `tokens_used` in minimal mode.\n\nFile v1.9.17:skill-card.md\n\n## Description: <br>\nAnalyze and improve the improvement process for detecting regressions and meta-optimization. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[athola](https://clawhub.ai/user/athola) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and agent operators use this skill to review skill-improvement outcomes, identify regression and success patterns, and propose strategy changes for future improvement work. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Local trace and improvement records may expose sensitive project activity, including tool names, file targets, decisions, rationales, outcomes, and aggregate improvement patterns. <br>\nMitigation: Review or clear ~/.claude/skills/traces/ and improvement_memory.json before installation or use in sensitive environments. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/athola/skills/nm-abstract-metacognitive-self-mod) <br>\n- [OpenClaw homepage](https://github.com/athola/claude-night-market/tree/master/plugins/abstract) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Analysis, Markdown, Guidance, Code, Shell commands] <br>\n**Output Format:** [Markdown report with inline code and shell snippets] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [None] <br>\n\n## Skill Version(s): <br>\n1.9.17 (source: server release metadata) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v1.9.16: 4 files, 7778 bytes\n\nFiles: modules/trace-capture.md (6035b), skill-card.md (2368b), SKILL.md (8366b), _meta.json (154b)\n\nFile v1.9.16:SKILL.md\n\n---\nname: metacognitive-self-mod\ndescription: |\n  Analyze and improve the improvement process. Use for detecting regressions and meta-optimization\nversion: 1.9.8\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/abstract\", \"emoji\": \"\\ud83e\\udd9e\"}}\nsource: claude-night-market\nsource_plugin: abstract\n---\n\n> **Night Market Skill** — ported from [claude-night-market/abstract](https://github.com/athola/claude-night-market/tree/master/plugins/abstract). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n# Metacognitive Self-Modification\n\nAnalyze the effectiveness of past skill improvements and\nrefine the improvement process itself. This is the core\ninnovation from the Hyperagents paper: not just improving\nskills, but improving HOW skills are improved.\n\n## Context Triggers (auto-invocation)\n\nThis skill should be invoked automatically when:\n\n1. **Regression detected**: The homeostatic monitor finds\n   a skill's evaluation window ended in\n   `pending_rollback_review` status. The improvement\n   made things worse -- we need to understand why.\n\n2. **Low effectiveness rate**: When\n   `ImprovementMemory.get_effective_strategies()` vs\n   `get_failed_strategies()` shows effectiveness below\n   50%, the improvement process itself needs refinement.\n\n3. **Degradation despite improvements**: When\n   `PerformanceTracker.get_improvement_trend()` returns\n   negative for a skill that was recently improved.\n\n4. **Periodic check**: After every 10 improvement cycles\n   (tracked via outcome count in ImprovementMemory).\n\n### Hook integration\n\nThe homeostatic monitor emits\n`\"improvement_triggered\": true` when a skill crosses the\nflag threshold. At that point, before dispatching the\nskill-improver, check if metacognitive analysis is\nwarranted:\n\n```python\nfrom abstract.improvement_memory import ImprovementMemory\nfrom pathlib import Path\n\nmemory = ImprovementMemory(\n    Path.home() / \".claude/skills/improvement_memory.json\"\n)\n\n# Check if metacognitive analysis is warranted\neffective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\ntotal = len(effective) + len(failed)\n\nneeds_metacognition = False\n\n# Trigger 1: Low effectiveness rate\nif total >= 5 and len(effective) / total < 0.5:\n    needs_metacognition = True\n\n# Trigger 2: Periodic check (every 10 outcomes)\nif total > 0 and total % 10 == 0:\n    needs_metacognition = True\n\n# Trigger 3: Recent regression\nif failed and failed[-1].get(\"outcome_type\") == \"failure\":\n    needs_metacognition = True\n\nif needs_metacognition:\n    # Run metacognitive analysis before next improvement\n    pass  # Skill(abstract:metacognitive-self-mod)\n```\n\n## When To Use (Manual)\n\n- After a batch of skill improvements to assess what\n  worked\n- When improvement outcomes show regressions\n- Periodically (monthly) to refine improvement strategy\n- When the skill-improver agent seems ineffective\n\n## When NOT To Use\n\n- Routine skill improvements (use skill-improver directly)\n- First-time skill creation (use skill-authoring)\n\n## Workflow\n\n### Step 1: Load improvement data\n\nRead improvement memory and performance tracker data:\n\n```bash\n# Check for improvement memory\nMEMORY_FILE=~/.claude/skills/improvement_memory.json\nTRACKER_FILE=~/.claude/skills/performance_history.json\n\nif [ ! -f \"$MEMORY_FILE\" ]; then\n  echo \"No improvement memory found.\"\n  echo \"Run skill-improver first to generate improvement data.\"\n  exit 0\nfi\n```\n\nLoad the JSON files using Python:\n\n```python\nfrom abstract.improvement_memory import ImprovementMemory\nfrom abstract.performance_tracker import PerformanceTracker\nfrom pathlib import Path\n\nmemory = ImprovementMemory(Path.home() / \".claude/skills/improvement_memory.json\")\ntracker = PerformanceTracker(Path.home() / \".claude/skills/performance_history.json\")\n```\n\n### Step 2: Classify improvement outcomes\n\nFor each improvement outcome in memory, classify:\n\n- **Effective**: `after_score - before_score >= 0.1`\n- **Neutral**: `-0.1 < improvement < 0.1`\n- **Regression**: `after_score < before_score`\n\n```python\neffective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\n\n# Calculate effectiveness rate\ntotal = len(effective) + len(failed)\nif total > 0:\n    effectiveness_rate = len(effective) / total\n```\n\n### Step 3: Extract meta-patterns\n\nAnalyze WHAT types of improvements succeed vs fail:\n\n**Success patterns to look for**:\n\n- Adding error handling (reduces failure rate)\n- Adding examples (improves user ratings)\n- Adding quiet/verbose modes (reduces friction)\n- Simplifying workflow steps (reduces duration)\n\n**Failure patterns to look for**:\n\n- Over-engineering (adding too many options)\n- Breaking existing workflows (regression)\n- Adding complexity without validation\n- Token budget overflow from verbose additions\n\nFor each pattern found, record as a causal hypothesis:\n\n```python\nmemory.record_insight(\n    skill_ref=\"_meta\",  # Special ref for meta-insights\n    category=\"causal_hypothesis\",\n    insight=\"Error handling improvements have 85% success rate\",\n    evidence=[\"skill-A v1.1.0: +0.3\", \"skill-B v2.1.0: +0.15\"]\n)\n```\n\n### Step 4: Analyze improvement trends\n\nUse PerformanceTracker to identify:\n\n- Skills with sustained improvement (positive trend)\n- Skills with degradation despite improvement attempts\n- Domains where improvements are most effective\n\n```python\nfor skill_ref in tracker.get_all_skill_refs():\n    trend = tracker.get_improvement_trend(skill_ref)\n    if trend is not None:\n        if trend > 0.05:\n            # Sustained improvement - what's working?\n            pass\n        elif trend < -0.05:\n            # Degrading despite improvements - investigate\n            pass\n```\n\n### Step 5: Generate strategy recommendations\n\nBased on the meta-analysis, generate recommendations for\nthe skill-improver:\n\n1. **Priority formula adjustments**: If certain issue\n   types have higher improvement success rates, weight\n   them higher.\n\n2. **Approach selection**: If \"add error handling\" has 85%\n   success vs \"restructure workflow\" at 30%, bias toward\n   error handling.\n\n3. **Threshold adjustments**: If improvements below\n   priority 3.0 consistently fail, raise the minimum\n   threshold.\n\n4. **Avoidance rules**: Document anti-patterns to avoid\n   in future improvements.\n\n### Step 6: Store meta-insights\n\nRecord all findings back into ImprovementMemory under the\nspecial `_meta` skill ref:\n\n```python\n# Record strategy recommendation\nmemory.record_insight(\n    skill_ref=\"_meta\",\n    category=\"strategy_success\",\n    insight=\"Recommendation: Prioritize error handling and examples over restructuring\",\n    evidence=[f\"Success rate: error_handling={eh_rate:.0%}, restructure={rs_rate:.0%}\"]\n)\n```\n\n### Step 7: Update skill-improver strategy\n\nIf significant meta-insights are found, propose concrete\nmodifications to the skill-improver agent:\n\n- Update priority weights in the priority formula\n- Add avoidance rules for known anti-patterns\n- Adjust thresholds based on empirical data\n- Add new improvement patterns that proved effective\n\n**Important**: Propose changes, do not auto-apply. The user\nmust approve modifications to the improvement process.\n\n## Output\n\n```\nMetacognitive Self-Modification Report\n\nImprovement Data:\n  Total outcomes analyzed: 15\n  Effective improvements: 11 (73%)\n  Regressions: 2 (13%)\n  Neutral: 2 (13%)\n\nSuccess Patterns:\n  1. Error handling additions: 5/6 success (83%)\n  2. Example additions: 3/3 success (100%)\n  3. Quiet mode additions: 2/2 success (100%)\n\nFailure Patterns:\n  1. Workflow restructuring: 1/3 success (33%)\n  2. Token-heavy additions: 0/1 success (0%)\n\nPerformance Trends:\n  Improving: 8 skills (positive trend)\n  Stable: 4 skills (no trend)\n  Degrading: 1 skill (negative trend despite attempts)\n\nRecommendations:\n  1. Weight error handling improvements 2x in priority\n  2. Avoid workflow restructuring below priority 8.0\n  3. Cap additions at 200 tokens to prevent budget overflow\n  4. Focus next improvement cycle on degrading skill X\n\nMeta-insights stored: 5 new entries in improvement memory\n```\n\n## Related\n\n- `abstract:skill-improver` - The agent this skill analyzes\n  and proposes modifications for\n- `abstract:skills-eval` - Evaluation framework whose\n  criteria could be refined by meta-insights\n- `abstract:aggregate-logs` - Data source for improvement\n  metrics\n\nFile v1.9.16:_meta.json\n\n{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-abstract-metacognitive-self-mod\",\n  \"version\": \"1.9.16\",\n  \"publishedAt\": 1784058274348\n}\n\nFile v1.9.16:modules/trace-capture.md\n\n---\nname: trace-capture\ndescription: >-\n  Execution trace recording for continuous\n  learning. Captures tool sequences, decision\n  points, and outcome attribution.\nparent_skill: abstract:metacognitive-self-mod\ncategory: self-improvement\ntags: [traces, execution-recording, attribution, continuous-learning]\ndependencies: [metacognitive-self-mod]\nestimated_tokens: 200\n---\n\n# Execution Trace Capture\n\nRecord execution traces so that metacognitive-self-mod\ncan analyze concrete decision sequences, not just\naggregate metrics. Inspired by Microsoft Trace\n(AutoDiff-like backward propagation through execution\ntraces), Trajectory-Informed Memory Generation (arXiv\n2603.10600, decision attribution from trajectories),\nand the ACE framework (evolving playbooks via\ngeneration, reflection, and curation).\n\n## Trace Structure\n\nEach trace captures a single skill invocation from start\nto finish. The trace body sits inside the shared\nsession-capture envelope (ADR-0011) so friction signals\nand traces can be consumed through one parser:\n\n```json\n{\n  \"schema_version\": \"session-capture/1\",\n  \"session_id\": \"2026-04-14-abc12345\",\n  \"timestamp\": \"2026-04-14T10:30:00Z\",\n  \"source\": \"trace-capture\",\n  \"payload\": {\n    \"trace_id\": \"session-{date}-{hash}\",\n    \"skill\": \"attune:project-execution\",\n    \"started\": \"2026-04-14T10:30:00Z\",\n    \"completed\": \"2026-04-14T10:32:15Z\",\n    \"outcome\": \"success\",\n    \"capture_mode\": \"decision-only\",\n    \"steps\": [\n      {\n        \"tool\": \"Read\",\n        \"target\": \"src/main.py\",\n        \"purpose\": \"understand entry point\",\n        \"result\": \"success\",\n        \"tokens_used\": 1200,\n        \"decision_point\": false\n      },\n      {\n        \"tool\": \"Edit\",\n        \"target\": \"src/main.py:45\",\n        \"purpose\": \"add error handling\",\n        \"result\": \"success\",\n        \"tokens_used\": 800,\n        \"decision_point\": true,\n        \"alternatives_considered\": [\n          \"try/except\",\n          \"result type\",\n          \"assertion\"\n        ],\n        \"rationale\": \"try/except matches existing patterns\"\n      }\n    ],\n    \"attribution\": {\n      \"success_factors\": [\n        \"followed existing patterns\",\n        \"tested incrementally\"\n      ],\n      \"failure_factors\": [],\n      \"key_decisions\": [\n        \"chose try/except over result type at step 4\"\n      ]\n    }\n  }\n}\n```\n\nLegacy traces written before envelope adoption are read\nas ``session-capture/0`` (entire file treated as the\npayload). See ``docs/adr/0011-session-capture-envelope.md``\nfor the contract and migration path.\n\n## Capture Modes\n\nNot every invocation needs a full trace. Three modes\ncontrol the recording fidelity.\n\n| Mode | Records | When to use |\n|------|---------|-------------|\n| `minimal` | Outcome and duration only | High-trust T3 skills |\n| `decision-only` | Decision points, outcome, duration | Default for all skills |\n| `full` | Every tool call, token counts, all fields | Skills with <85% success rate |\n\n**Mode selection logic:**\n\n- Default: `decision-only` (captures rationale without\n  flooding storage).\n- Enable `full` with `--trace=full` or automatically for\n  any skill whose rolling success rate falls below 85%.\n- Use `minimal` for T3 skills that consistently succeed\n  and need only aggregate trend data.\n\n## What to Capture\n\n- **Tool calls** (full mode only): tool name, target,\n  purpose, result, approximate tokens consumed.\n- **Decision points** (all modes except minimal):\n  alternatives considered (2-5), rationale for the\n  chosen option, whether later revised.\n- **Trace completion** (all modes): overall outcome\n  (`success`/`failure`/`partial`), wall-clock duration,\n  total tokens consumed.\n\n## Attribution Analysis\n\nAfter a trace completes, run backward attribution to\nidentify which decisions drove the outcome. This follows\nthe Microsoft Trace principle of propagating feedback\nbackward through the execution path.\n\n**For successful traces:**\n\n1. Identify decisions that aligned with known success\n   patterns (from `improvement_memory.json`).\n2. Flag novel successful patterns as candidate hypotheses.\n3. Record `success_factors` in the trace's `attribution`\n   block.\n\n**For failed traces:**\n\n1. Walk backward from the failure point.\n2. Identify the earliest decision that diverged from\n   known-good patterns.\n3. Record `failure_factors` and the specific decision.\n4. Generate a causal hypothesis for ImprovementMemory:\n\n```python\nmemory.record_insight(\n    skill_ref=trace[\"skill\"],\n    category=\"causal_hypothesis\",\n    insight=\"Failure correlated with choosing X over Y\",\n    evidence=[f\"trace:{trace['trace_id']}\"]\n)\n```\n\n**Cross-trace pattern detection:**\n\nWhen 5 or more traces exist for a skill, scan for\nrecurring decision-outcome correlations:\n\n- Decisions that appear in >70% of successful traces\n  become \"recommended patterns.\"\n- Decisions that appear in >50% of failed traces become\n  \"anti-patterns.\"\n\n## Storage\n\n| Location | Contents | Retention |\n|----------|----------|-----------|\n| `~/.claude/skills/traces/` | Raw JSON trace files | Rolling 30-day window |\n| `improvement_memory.json` | Aggregate patterns and hypotheses | Persistent |\n\n**Budget:** Maximum 100 trace files, FIFO eviction.\nTraces linked to active causal hypotheses are protected\nuntil the hypothesis is resolved. File naming:\n`{trace_id}.json` (one file per trace).\n\n## Integration Points\n\n- **metacognitive-self-mod** (parent): consumes traces\n  during periodic analysis (Step 3) to inspect specific\n  decisions behind success or failure.\n- **skill-improver**: queries traces for a target skill\n  before proposing changes. Targets recurring failure\n  points directly.\n- **friction-detector**: cross-references friction signals\n  with trace data to pinpoint where a workflow broke.\n\n## Lightweight by Default\n\nThe default `decision-only` mode records only branching\npoints (typically 3-8 entries per trace vs 20-50 for\nfull mode). Additional storage hygiene:\n\n- Prune full-mode traces older than 7 days down to\n  decision-only.\n- Cap `alternatives_considered` at 5 entries.\n- Omit `tokens_used` in minimal mode.\n\nFile v1.9.16:skill-card.md\n\n## Description: <br>\nAnalyze and improve the improvement process for skill changes by detecting regressions, assessing improvement effectiveness, and generating meta-optimization recommendations. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[athola](https://clawhub.ai/user/athola) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and agent operators use this skill after batches of skill improvements, regressions, or periodic reviews to analyze what improvement strategies worked and what should change in future improvement workflows. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Local trace and improvement-memory records may include project names, file paths, tool targets, decisions, outcomes, and rationales. <br>\nMitigation: Review the stored files under ~/.claude/skills/traces and improvement_memory.json, limit use on sensitive workflows, and periodically clear local records when retention is not needed. <br>\nRisk: Meta-optimization recommendations could steer future skill-improvement behavior incorrectly if based on sparse or noisy history. <br>\nMitigation: Treat recommendations as proposals, require user approval before changing improvement strategy, and validate changes against recent outcomes before relying on them. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/athola/skills/nm-abstract-metacognitive-self-mod) <br>\n- [OpenClaw metadata homepage](https://github.com/athola/claude-night-market/tree/master/plugins/abstract) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Text, Markdown, Guidance, Configuration] <br>\n**Output Format:** [Markdown report with recommendations and optional local JSON insight or trace records] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [Proposes changes for user approval; does not auto-apply modifications to the improvement process.] <br>\n\n## Skill Version(s): <br>\n1.9.16 (source: server release metadata; artifact frontmatter lists 1.9.8) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v1.9.15: 4 files, 7789 bytes\n\nFiles: modules/trace-capture.md (6035b), skill-card.md (2389b), SKILL.md (8366b), _meta.json (154b)\n\nFile v1.9.15:SKILL.md\n\n---\nname: metacognitive-self-mod\ndescription: |\n  Analyze and improve the improvement process. Use for detecting regressions and meta-optimization\nversion: 1.9.8\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/abstract\", \"emoji\": \"\\ud83e\\udd9e\"}}\nsource: claude-night-market\nsource_plugin: abstract\n---\n\n> **Night Market Skill** — ported from [claude-night-market/abstract](https://github.com/athola/claude-night-market/tree/master/plugins/abstract). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n# Metacognitive Self-Modification\n\nAnalyze the effectiveness of past skill improvements and\nrefine the improvement process itself. This is the core\ninnovation from the Hyperagents paper: not just improving\nskills, but improving HOW skills are improved.\n\n## Context Triggers (auto-invocation)\n\nThis skill should be invoked automatically when:\n\n1. **Regression detected**: The homeostatic monitor finds\n   a skill's evaluation window ended in\n   `pending_rollback_review` status. The improvement\n   made things worse -- we need to understand why.\n\n2. **Low effectiveness rate**: When\n   `ImprovementMemory.get_effective_strategies()` vs\n   `get_failed_strategies()` shows effectiveness below\n   50%, the improvement process itself needs refinement.\n\n3. **Degradation despite improvements**: When\n   `PerformanceTracker.get_improvement_trend()` returns\n   negative for a skill that was recently improved.\n\n4. **Periodic check**: After every 10 improvement cycles\n   (tracked via outcome count in ImprovementMemory).\n\n### Hook integration\n\nThe homeostatic monitor emits\n`\"improvement_triggered\": true` when a skill crosses the\nflag threshold. At that point, before dispatching the\nskill-improver, check if metacognitive analysis is\nwarranted:\n\n```python\nfrom abstract.improvement_memory import ImprovementMemory\nfrom pathlib import Path\n\nmemory = ImprovementMemory(\n    Path.home() / \".claude/skills/improvement_memory.json\"\n)\n\n# Check if metacognitive analysis is warranted\neffective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\ntotal = len(effective) + len(failed)\n\nneeds_metacognition = False\n\n# Trigger 1: Low effectiveness rate\nif total >= 5 and len(effective) / total < 0.5:\n    needs_metacognition = True\n\n# Trigger 2: Periodic check (every 10 outcomes)\nif total > 0 and total % 10 == 0:\n    needs_metacognition = True\n\n# Trigger 3: Recent regression\nif failed and failed[-1].get(\"outcome_type\") == \"failure\":\n    needs_metacognition = True\n\nif needs_metacognition:\n    # Run metacognitive analysis before next improvement\n    pass  # Skill(abstract:metacognitive-self-mod)\n```\n\n## When To Use (Manual)\n\n- After a batch of skill improvements to assess what\n  worked\n- When improvement outcomes show regressions\n- Periodically (monthly) to refine improvement strategy\n- When the skill-improver agent seems ineffective\n\n## When NOT To Use\n\n- Routine skill improvements (use skill-improver directly)\n- First-time skill creation (use skill-authoring)\n\n## Workflow\n\n### Step 1: Load improvement data\n\nRead improvement memory and performance tracker data:\n\n```bash\n# Check for improvement memory\nMEMORY_FILE=~/.claude/skills/improvement_memory.json\nTRACKER_FILE=~/.claude/skills/performance_history.json\n\nif [ ! -f \"$MEMORY_FILE\" ]; then\n  echo \"No improvement memory found.\"\n  echo \"Run skill-improver first to generate improvement data.\"\n  exit 0\nfi\n```\n\nLoad the JSON files using Python:\n\n```python\nfrom abstract.improvement_memory import ImprovementMemory\nfrom abstract.performance_tracker import PerformanceTracker\nfrom pathlib import Path\n\nmemory = ImprovementMemory(Path.home() / \".claude/skills/improvement_memory.json\")\ntracker = PerformanceTracker(Path.home() / \".claude/skills/performance_history.json\")\n```\n\n### Step 2: Classify improvement outcomes\n\nFor each improvement outcome in memory, classify:\n\n- **Effective**: `after_score - before_score >= 0.1`\n- **Neutral**: `-0.1 < improvement < 0.1`\n- **Regression**: `after_score < before_score`\n\n```python\neffective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\n\n# Calculate effectiveness rate\ntotal = len(effective) + len(failed)\nif total > 0:\n    effectiveness_rate = len(effective) / total\n```\n\n### Step 3: Extract meta-patterns\n\nAnalyze WHAT types of improvements succeed vs fail:\n\n**Success patterns to look for**:\n\n- Adding error handling (reduces failure rate)\n- Adding examples (improves user ratings)\n- Adding quiet/verbose modes (reduces friction)\n- Simplifying workflow steps (reduces duration)\n\n**Failure patterns to look for**:\n\n- Over-engineering (adding too many options)\n- Breaking existing workflows (regression)\n- Adding complexity without validation\n- Token budget overflow from verbose additions\n\nFor each pattern found, record as a causal hypothesis:\n\n```python\nmemory.record_insight(\n    skill_ref=\"_meta\",  # Special ref for meta-insights\n    category=\"causal_hypothesis\",\n    insight=\"Error handling improvements have 85% success rate\",\n    evidence=[\"skill-A v1.1.0: +0.3\", \"skill-B v2.1.0: +0.15\"]\n)\n```\n\n### Step 4: Analyze improvement trends\n\nUse PerformanceTracker to identify:\n\n- Skills with sustained improvement (positive trend)\n- Skills with degradation despite improvement attempts\n- Domains where improvements are most effective\n\n```python\nfor skill_ref in tracker.get_all_skill_refs():\n    trend = tracker.get_improvement_trend(skill_ref)\n    if trend is not None:\n        if trend > 0.05:\n            # Sustained improvement - what's working?\n            pass\n        elif trend < -0.05:\n            # Degrading despite improvements - investigate\n            pass\n```\n\n### Step 5: Generate strategy recommendations\n\nBased on the meta-analysis, generate recommendations for\nthe skill-improver:\n\n1. **Priority formula adjustments**: If certain issue\n   types have higher improvement success rates, weight\n   them higher.\n\n2. **Approach selection**: If \"add error handling\" has 85%\n   success vs \"restructure workflow\" at 30%, bias toward\n   error handling.\n\n3. **Threshold adjustments**: If improvements below\n   priority 3.0 consistently fail, raise the minimum\n   threshold.\n\n4. **Avoidance rules**: Document anti-patterns to avoid\n   in future improvements.\n\n### Step 6: Store meta-insights\n\nRecord all findings back into ImprovementMemory under the\nspecial `_meta` skill ref:\n\n```python\n# Record strategy recommendation\nmemory.record_insight(\n    skill_ref=\"_meta\",\n    category=\"strategy_success\",\n    insight=\"Recommendation: Prioritize error handling and examples over restructuring\",\n    evidence=[f\"Success rate: error_handling={eh_rate:.0%}, restructure={rs_rate:.0%}\"]\n)\n```\n\n### Step 7: Update skill-improver strategy\n\nIf significant meta-insights are found, propose concrete\nmodifications to the skill-improver agent:\n\n- Update priority weights in the priority formula\n- Add avoidance rules for known anti-patterns\n- Adjust thresholds based on empirical data\n- Add new improvement patterns that proved effective\n\n**Important**: Propose changes, do not auto-apply. The user\nmust approve modifications to the improvement process.\n\n## Output\n\n```\nMetacognitive Self-Modification Report\n\nImprovement Data:\n  Total outcomes analyzed: 15\n  Effective improvements: 11 (73%)\n  Regressions: 2 (13%)\n  Neutral: 2 (13%)\n\nSuccess Patterns:\n  1. Error handling additions: 5/6 success (83%)\n  2. Example additions: 3/3 success (100%)\n  3. Quiet mode additions: 2/2 success (100%)\n\nFailure Patterns:\n  1. Workflow restructuring: 1/3 success (33%)\n  2. Token-heavy additions: 0/1 success (0%)\n\nPerformance Trends:\n  Improving: 8 skills (positive trend)\n  Stable: 4 skills (no trend)\n  Degrading: 1 skill (negative trend despite attempts)\n\nRecommendations:\n  1. Weight error handling improvements 2x in priority\n  2. Avoid workflow restructuring below priority 8.0\n  3. Cap additions at 200 tokens to prevent budget overflow\n  4. Focus next improvement cycle on degrading skill X\n\nMeta-insights stored: 5 new entries in improvement memory\n```\n\n## Related\n\n- `abstract:skill-improver` - The agent this skill analyzes\n  and proposes modifications for\n- `abstract:skills-eval` - Evaluation framework whose\n  criteria could be refined by meta-insights\n- `abstract:aggregate-logs` - Data source for improvement\n  metrics\n\nFile v1.9.15:_meta.json\n\n{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-abstract-metacognitive-self-mod\",\n  \"version\": \"1.9.15\",\n  \"publishedAt\": 1783199952325\n}\n\nFile v1.9.15:modules/trace-capture.md\n\n---\nname: trace-capture\ndescription: >-\n  Execution trace recording for continuous\n  learning. Captures tool sequences, decision\n  points, and outcome attribution.\nparent_skill: abstract:metacognitive-self-mod\ncategory: self-improvement\ntags: [traces, execution-recording, attribution, continuous-learning]\ndependencies: [metacognitive-self-mod]\nestimated_tokens: 200\n---\n\n# Execution Trace Capture\n\nRecord execution traces so that metacognitive-self-mod\ncan analyze concrete decision sequences, not just\naggregate metrics. Inspired by Microsoft Trace\n(AutoDiff-like backward propagation through execution\ntraces), Trajectory-Informed Memory Generation (arXiv\n2603.10600, decision attribution from trajectories),\nand the ACE framework (evolving playbooks via\ngeneration, reflection, and curation).\n\n## Trace Structure\n\nEach trace captures a single skill invocation from start\nto finish. The trace body sits inside the shared\nsession-capture envelope (ADR-0011) so friction signals\nand traces can be consumed through one parser:\n\n```json\n{\n  \"schema_version\": \"session-capture/1\",\n  \"session_id\": \"2026-04-14-abc12345\",\n  \"timestamp\": \"2026-04-14T10:30:00Z\",\n  \"source\": \"trace-capture\",\n  \"payload\": {\n    \"trace_id\": \"session-{date}-{hash}\",\n    \"skill\": \"attune:project-execution\",\n    \"started\": \"2026-04-14T10:30:00Z\",\n    \"completed\": \"2026-04-14T10:32:15Z\",\n    \"outcome\": \"success\",\n    \"capture_mode\": \"decision-only\",\n    \"steps\": [\n      {\n        \"tool\": \"Read\",\n        \"target\": \"src/main.py\",\n        \"purpose\": \"understand entry point\",\n        \"result\": \"success\",\n        \"tokens_used\": 1200,\n        \"decision_point\": false\n      },\n      {\n        \"tool\": \"Edit\",\n        \"target\": \"src/main.py:45\",\n        \"purpose\": \"add error handling\",\n        \"result\": \"success\",\n        \"tokens_used\": 800,\n        \"decision_point\": true,\n        \"alternatives_considered\": [\n          \"try/except\",\n          \"result type\",\n          \"assertion\"\n        ],\n        \"rationale\": \"try/except matches existing patterns\"\n      }\n    ],\n    \"attribution\": {\n      \"success_factors\": [\n        \"followed existing patterns\",\n        \"tested incrementally\"\n      ],\n      \"failure_factors\": [],\n      \"key_decisions\": [\n        \"chose try/except over result type at step 4\"\n      ]\n    }\n  }\n}\n```\n\nLegacy traces written before envelope adoption are read\nas ``session-capture/0`` (entire file treated as the\npayload). See ``docs/adr/0011-session-capture-envelope.md``\nfor the contract and migration path.\n\n## Capture Modes\n\nNot every invocation needs a full trace. Three modes\ncontrol the recording fidelity.\n\n| Mode | Records | When to use |\n|------|---------|-------------|\n| `minimal` | Outcome and duration only | High-trust T3 skills |\n| `decision-only` | Decision points, outcome, duration | Default for all skills |\n| `full` | Every tool call, token counts, all fields | Skills with <85% success rate |\n\n**Mode selection logic:**\n\n- Default: `decision-only` (captures rationale without\n  flooding storage).\n- Enable `full` with `--trace=full` or automatically for\n  any skill whose rolling success rate falls below 85%.\n- Use `minimal` for T3 skills that consistently succeed\n  and need only aggregate trend data.\n\n## What to Capture\n\n- **Tool calls** (full mode only): tool name, target,\n  purpose, result, approximate tokens consumed.\n- **Decision points** (all modes except minimal):\n  alternatives considered (2-5), rationale for the\n  chosen option, whether later revised.\n- **Trace completion** (all modes): overall outcome\n  (`success`/`failure`/`partial`), wall-clock duration,\n  total tokens consumed.\n\n## Attribution Analysis\n\nAfter a trace completes, run backward attribution to\nidentify which decisions drove the outcome. This follows\nthe Microsoft Trace principle of propagating feedback\nbackward through the execution path.\n\n**For successful traces:**\n\n1. Identify decisions that aligned with known success\n   patterns (from `improvement_memory.json`).\n2. Flag novel successful patterns as candidate hypotheses.\n3. Record `success_factors` in the trace's `attribution`\n   block.\n\n**For failed traces:**\n\n1. Walk backward from the failure point.\n2. Identify the earliest decision that diverged from\n   known-good patterns.\n3. Record `failure_factors` and the specific decision.\n4. Generate a causal hypothesis for ImprovementMemory:\n\n```python\nmemory.record_insight(\n    skill_ref=trace[\"skill\"],\n    category=\"causal_hypothesis\",\n    insight=\"Failure correlated with choosing X over Y\",\n    evidence=[f\"trace:{trace['trace_id']}\"]\n)\n```\n\n**Cross-trace pattern detection:**\n\nWhen 5 or more traces exist for a skill, scan for\nrecurring decision-outcome correlations:\n\n- Decisions that appear in >70% of successful traces\n  become \"recommended patterns.\"\n- Decisions that appear in >50% of failed traces become\n  \"anti-patterns.\"\n\n## Storage\n\n| Location | Contents | Retention |\n|----------|----------|-----------|\n| `~/.claude/skills/traces/` | Raw JSON trace files | Rolling 30-day window |\n| `improvement_memory.json` | Aggregate patterns and hypotheses | Persistent |\n\n**Budget:** Maximum 100 trace files, FIFO eviction.\nTraces linked to active causal hypotheses are protected\nuntil the hypothesis is resolved. File naming:\n`{trace_id}.json` (one file per trace).\n\n## Integration Points\n\n- **metacognitive-self-mod** (parent): consumes traces\n  during periodic analysis (Step 3) to inspect specific\n  decisions behind success or failure.\n- **skill-improver**: queries traces for a target skill\n  before proposing changes. Targets recurring failure\n  points directly.\n- **friction-detector**: cross-references friction signals\n  with trace data to pinpoint where a workflow broke.\n\n## Lightweight by Default\n\nThe default `decision-only` mode records only branching\npoints (typically 3-8 entries per trace vs 20-50 for\nfull mode). Additional storage hygiene:\n\n- Prune full-mode traces older than 7 days down to\n  decision-only.\n- Cap `alternatives_considered` at 5 entries.\n- Omit `tokens_used` in minimal mode.\n\nFile v1.9.15:skill-card.md\n\n## Description: <br>\nAnalyze and improve skill-improvement processes for regressions and meta-optimization. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[athola](https://clawhub.ai/user/athola) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and agent operators use this skill to review prior skill-improvement outcomes, identify success and failure patterns, and recommend strategy adjustments for future improvement cycles. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Local audit trails may capture sensitive project activity, including agent decisions, file targets, and workflow outcomes. <br>\nMitigation: Use the skill in non-sensitive projects where possible, and regularly review or delete ~/.claude/skills/traces and improvement_memory.json. <br>\nRisk: Full tracing can record broader tool sequences and decision rationale than a minimal outcome log. <br>\nMitigation: Prefer decision-only or minimal tracing, and enable full tracing only when the added diagnostic detail is explicitly needed. <br>\nRisk: Recommendations could change future skill-improvement strategy based on incomplete or noisy outcome data. <br>\nMitigation: Review proposed strategy changes before applying them; the artifact states that modifications to the improvement process require user approval. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/athola/skills/nm-abstract-metacognitive-self-mod) <br>\n- [Clawdis homepage](https://github.com/athola/claude-night-market/tree/master/plugins/abstract) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance] <br>\n**Output Format:** [Markdown report with inline shell and Python examples] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May record meta-insights and propose strategy changes; artifact guidance requires user approval before modifying the improvement process.] <br>\n\n## Skill Version(s): <br>\n1.9.15 (source: release evidence) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v1.9.14: 4 files, 7675 bytes\n\nFiles: modules/trace-capture.md (6035b), skill-card.md (2129b), SKILL.md (8366b), _meta.json (154b)\n\nFile v1.9.14:SKILL.md\n\n---\nname: metacognitive-self-mod\ndescription: |\n  Analyze and improve the improvement process. Use for detecting regressions and meta-optimization\nversion: 1.9.8\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/abstract\", \"emoji\": \"\\ud83e\\udd9e\"}}\nsource: claude-night-market\nsource_plugin: abstract\n---\n\n> **Night Market Skill** — ported from [claude-night-market/abstract](https://github.com/athola/claude-night-market/tree/master/plugins/abstract). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n# Metacognitive Self-Modification\n\nAnalyze the effectiveness of past skill improvements and\nrefine the improvement process itself. This is the core\ninnovation from the Hyperagents paper: not just improving\nskills, but improving HOW skills are improved.\n\n## Context Triggers (auto-invocation)\n\nThis skill should be invoked automatically when:\n\n1. **Regression detected**: The homeostatic monitor finds\n   a skill's evaluation window ended in\n   `pending_rollback_review` status. The improvement\n   made things worse -- we need to understand why.\n\n2. **Low effectiveness rate**: When\n   `ImprovementMemory.get_effective_strategies()` vs\n   `get_failed_strategies()` shows effectiveness below\n   50%, the improvement process itself needs refinement.\n\n3. **Degradation despite improvements**: When\n   `PerformanceTracker.get_improvement_trend()` returns\n   negative for a skill that was recently improved.\n\n4. **Periodic check**: After every 10 improvement cycles\n   (tracked via outcome count in ImprovementMemory).\n\n### Hook integration\n\nThe homeostatic monitor emits\n`\"improvement_triggered\": true` when a skill crosses the\nflag threshold. At that point, before dispatching the\nskill-improver, check if metacognitive analysis is\nwarranted:\n\n```python\nfrom abstract.improvement_memory import ImprovementMemory\nfrom pathlib import Path\n\nmemory = ImprovementMemory(\n    Path.home() / \".claude/skills/improvement_memory.json\"\n)\n\n# Check if metacognitive analysis is warranted\neffective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\ntotal = len(effective) + len(failed)\n\nneeds_metacognition = False\n\n# Trigger 1: Low effectiveness rate\nif total >= 5 and len(effective) / total < 0.5:\n    needs_metacognition = True\n\n# Trigger 2: Periodic check (every 10 outcomes)\nif total > 0 and total % 10 == 0:\n    needs_metacognition = True\n\n# Trigger 3: Recent regression\nif failed and failed[-1].get(\"outcome_type\") == \"failure\":\n    needs_metacognition = True\n\nif needs_metacognition:\n    # Run metacognitive analysis before next improvement\n    pass  # Skill(abstract:metacognitive-self-mod)\n```\n\n## When To Use (Manual)\n\n- After a batch of skill improvements to assess what\n  worked\n- When improvement outcomes show regressions\n- Periodically (monthly) to refine improvement strategy\n- When the skill-improver agent seems ineffective\n\n## When NOT To Use\n\n- Routine skill improvements (use skill-improver directly)\n- First-time skill creation (use skill-authoring)\n\n## Workflow\n\n### Step 1: Load improvement data\n\nRead improvement memory and performance tracker data:\n\n```bash\n# Check for improvement memory\nMEMORY_FILE=~/.claude/skills/improvement_memory.json\nTRACKER_FILE=~/.claude/skills/performance_history.json\n\nif [ ! -f \"$MEMORY_FILE\" ]; then\n  echo \"No improvement memory found.\"\n  echo \"Run skill-improver first to generate improvement data.\"\n  exit 0\nfi\n```\n\nLoad the JSON files using Python:\n\n```python\nfrom abstract.improvement_memory import ImprovementMemory\nfrom abstract.performance_tracker import PerformanceTracker\nfrom pathlib import Path\n\nmemory = ImprovementMemory(Path.home() / \".claude/skills/improvement_memory.json\")\ntracker = PerformanceTracker(Path.home() / \".claude/skills/performance_history.json\")\n```\n\n### Step 2: Classify improvement outcomes\n\nFor each improvement outcome in memory, classify:\n\n- **Effective**: `after_score - before_score >= 0.1`\n- **Neutral**: `-0.1 < improvement < 0.1`\n- **Regression**: `after_score < before_score`\n\n```python\neffective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\n\n# Calculate effectiveness rate\ntotal = len(effective) + len(failed)\nif total > 0:\n    effectiveness_rate = len(effective) / total\n```\n\n### Step 3: Extract meta-patterns\n\nAnalyze WHAT types of improvements succeed vs fail:\n\n**Success patterns to look for**:\n\n- Adding error handling (reduces failure rate)\n- Adding examples (improves user ratings)\n- Adding quiet/verbose modes (reduces friction)\n- Simplifying workflow steps (reduces duration)\n\n**Failure patterns to look for**:\n\n- Over-engineering (adding too many options)\n- Breaking existing workflows (regression)\n- Adding complexity without validation\n- Token budget overflow from verbose additions\n\nFor each pattern found, record as a causal hypothesis:\n\n```python\nmemory.record_insight(\n    skill_ref=\"_meta\",  # Special ref for meta-insights\n    category=\"causal_hypothesis\",\n    insight=\"Error handling improvements have 85% success rate\",\n    evidence=[\"skill-A v1.1.0: +0.3\", \"skill-B v2.1.0: +0.15\"]\n)\n```\n\n### Step 4: Analyze improvement trends\n\nUse PerformanceTracker to identify:\n\n- Skills with sustained improvement (positive trend)\n- Skills with degradation despite improvement attempts\n- Domains where improvements are most effective\n\n```python\nfor skill_ref in tracker.get_all_skill_refs():\n    trend = tracker.get_improvement_trend(skill_ref)\n    if trend is not None:\n        if trend > 0.05:\n            # Sustained improvement - what's working?\n            pass\n        elif trend < -0.05:\n            # Degrading despite improvements - investigate\n            pass\n```\n\n### Step 5: Generate strategy recommendations\n\nBased on the meta-analysis, generate recommendations for\nthe skill-improver:\n\n1. **Priority formula adjustments**: If certain issue\n   types have higher improvement success rates, weight\n   them higher.\n\n2. **Approach selection**: If \"add error handling\" has 85%\n   success vs \"restructure workflow\" at 30%, bias toward\n   error handling.\n\n3. **Threshold adjustments**: If improvements below\n   priority 3.0 consistently fail, raise the minimum\n   threshold.\n\n4. **Avoidance rules**: Document anti-patterns to avoid\n   in future improvements.\n\n### Step 6: Store meta-insights\n\nRecord all findings back into ImprovementMemory under the\nspecial `_meta` skill ref:\n\n```python\n# Record strategy recommendation\nmemory.record_insight(\n    skill_ref=\"_meta\",\n    category=\"strategy_success\",\n    insight=\"Recommendation: Prioritize error handling and examples over restructuring\",\n    evidence=[f\"Success rate: error_handling={eh_rate:.0%}, restructure={rs_rate:.0%}\"]\n)\n```\n\n### Step 7: Update skill-improver strategy\n\nIf significant meta-insights are found, propose concrete\nmodifications to the skill-improver agent:\n\n- Update priority weights in the priority formula\n- Add avoidance rules for known anti-patterns\n- Adjust thresholds based on empirical data\n- Add new improvement patterns that proved effective\n\n**Important**: Propose changes, do not auto-apply. The user\nmust approve modifications to the improvement process.\n\n## Output\n\n```\nMetacognitive Self-Modification Report\n\nImprovement Data:\n  Total outcomes analyzed: 15\n  Effective improvements: 11 (73%)\n  Regressions: 2 (13%)\n  Neutral: 2 (13%)\n\nSuccess Patterns:\n  1. Error handling additions: 5/6 success (83%)\n  2. Example additions: 3/3 success (100%)\n  3. Quiet mode additions: 2/2 success (100%)\n\nFailure Patterns:\n  1. Workflow restructuring: 1/3 success (33%)\n  2. Token-heavy additions: 0/1 success (0%)\n\nPerformance Trends:\n  Improving: 8 skills (positive trend)\n  Stable: 4 skills (no trend)\n  Degrading: 1 skill (negative trend despite attempts)\n\nRecommendations:\n  1. Weight error handling improvements 2x in priority\n  2. Avoid workflow restructuring below priority 8.0\n  3. Cap additions at 200 tokens to prevent budget overflow\n  4. Focus next improvement cycle on degrading skill X\n\nMeta-insights stored: 5 new entries in improvement memory\n```\n\n## Related\n\n- `abstract:skill-improver` - The agent this skill analyzes\n  and proposes modifications for\n- `abstract:skills-eval` - Evaluation framework whose\n  criteria could be refined by meta-insights\n- `abstract:aggregate-logs` - Data source for improvement\n  metrics\n\nFile v1.9.14:_meta.json\n\n{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-abstract-metacognitive-self-mod\",\n  \"version\": \"1.9.14\",\n  \"publishedAt\": 1782841787387\n}\n\nFile v1.9.14:modules/trace-capture.md\n\n---\nname: trace-capture\ndescription: >-\n  Execution trace recording for continuous\n  learning. Captures tool sequences, decision\n  points, and outcome attribution.\nparent_skill: abstract:metacognitive-self-mod\ncategory: self-improvement\ntags: [traces, execution-recording, attribution, continuous-learning]\ndependencies: [metacognitive-self-mod]\nestimated_tokens: 200\n---\n\n# Execution Trace Capture\n\nRecord execution traces so that metacognitive-self-mod\ncan analyze concrete decision sequences, not just\naggregate metrics. Inspired by Microsoft Trace\n(AutoDiff-like backward propagation through execution\ntraces), Trajectory-Informed Memory Generation (arXiv\n2603.10600, decision attribution from trajectories),\nand the ACE framework (evolving playbooks via\ngeneration, reflection, and curation).\n\n## Trace Structure\n\nEach trace captures a single skill invocation from start\nto finish. The trace body sits inside the shared\nsession-capture envelope (ADR-0011) so friction signals\nand traces can be consumed through one parser:\n\n```json\n{\n  \"schema_version\": \"session-capture/1\",\n  \"session_id\": \"2026-04-14-abc12345\",\n  \"timestamp\": \"2026-04-14T10:30:00Z\",\n  \"source\": \"trace-capture\",\n  \"payload\": {\n    \"trace_id\": \"session-{date}-{hash}\",\n    \"skill\": \"attune:project-execution\",\n    \"started\": \"2026-04-14T10:30:00Z\",\n    \"completed\": \"2026-04-14T10:32:15Z\",\n    \"outcome\": \"success\",\n    \"capture_mode\": \"decision-only\",\n    \"steps\": [\n      {\n        \"tool\": \"Read\",\n        \"target\": \"src/main.py\",\n        \"purpose\": \"understand entry point\",\n        \"result\": \"success\",\n        \"tokens_used\": 1200,\n        \"decision_point\": false\n      },\n      {\n        \"tool\": \"Edit\",\n        \"target\": \"src/main.py:45\",\n        \"purpose\": \"add error handling\",\n        \"result\": \"success\",\n        \"tokens_used\": 800,\n        \"decision_point\": true,\n        \"alternatives_considered\": [\n          \"try/except\",\n          \"result type\",\n          \"assertion\"\n        ],\n        \"rationale\": \"try/except matches existing patterns\"\n      }\n    ],\n    \"attribution\": {\n      \"success_factors\": [\n        \"followed existing patterns\",\n        \"tested incrementally\"\n      ],\n      \"failure_factors\": [],\n      \"key_decisions\": [\n        \"chose try/except over result type at step 4\"\n      ]\n    }\n  }\n}\n```\n\nLegacy traces written before envelope adoption are read\nas ``session-capture/0`` (entire file treated as the\npayload). See ``docs/adr/0011-session-capture-envelope.md``\nfor the contract and migration path.\n\n## Capture Modes\n\nNot every invocation needs a full trace. Three modes\ncontrol the recording fidelity.\n\n| Mode | Records | When to use |\n|------|---------|-------------|\n| `minimal` | Outcome and duration only | High-trust T3 skills |\n| `decision-only` | Decision points, outcome, duration | Default for all skills |\n| `full` | Every tool call, token counts, all fields | Skills with <85% success rate |\n\n**Mode selection logic:**\n\n- Default: `decision-only` (captures rationale without\n  flooding storage).\n- Enable `full` with `--trace=full` or automatically for\n  any skill whose rolling success rate falls below 85%.\n- Use `minimal` for T3 skills that consistently succeed\n  and need only aggregate trend data.\n\n## What to Capture\n\n- **Tool calls** (full mode only): tool name, target,\n  purpose, result, approximate tokens consumed.\n- **Decision points** (all modes except minimal):\n  alternatives considered (2-5), rationale for the\n  chosen option, whether later revised.\n- **Trace completion** (all modes): overall outcome\n  (`success`/`failure`/`partial`), wall-clock duration,\n  total tokens consumed.\n\n## Attribution Analysis\n\nAfter a trace completes, run backward attribution to\nidentify which decisions drove the outcome. This follows\nthe Microsoft Trace principle of propagating feedback\nbackward through the execution path.\n\n**For successful traces:**\n\n1. Identify decisions that aligned with known success\n   patterns (from `improvement_memory.json`).\n2. Flag novel successful patterns as candidate hypotheses.\n3. Record `success_factors` in the trace's `attribution`\n   block.\n\n**For failed traces:**\n\n1. Walk backward from the failure point.\n2. Identify the earliest decision that diverged from\n   known-good patterns.\n3. Record `failure_factors` and the specific decision.\n4. Generate a causal hypothesis for ImprovementMemory:\n\n```python\nmemory.record_insight(\n    skill_ref=trace[\"skill\"],\n    category=\"causal_hypothesis\",\n    insight=\"Failure correlated with choosing X over Y\",\n    evidence=[f\"trace:{trace['trace_id']}\"]\n)\n```\n\n**Cross-trace pattern detection:**\n\nWhen 5 or more traces exist for a skill, scan for\nrecurring decision-outcome correlations:\n\n- Decisions that appear in >70% of successful traces\n  become \"recommended patterns.\"\n- Decisions that appear in >50% of failed traces become\n  \"anti-patterns.\"\n\n## Storage\n\n| Location | Contents | Retention |\n|----------|----------|-----------|\n| `~/.claude/skills/traces/` | Raw JSON trace files | Rolling 30-day window |\n| `improvement_memory.json` | Aggregate patterns and hypotheses | Persistent |\n\n**Budget:** Maximum 100 trace files, FIFO eviction.\nTraces linked to active causal hypotheses are protected\nuntil the hypothesis is resolved. File naming:\n`{trace_id}.json` (one file per trace).\n\n## Integration Points\n\n- **metacognitive-self-mod** (parent): consumes traces\n  during periodic analysis (Step 3) to inspect specific\n  decisions behind success or failure.\n- **skill-improver**: queries traces for a target skill\n  before proposing changes. Targets recurring failure\n  points directly.\n- **friction-detector**: cross-references friction signals\n  with trace data to pinpoint where a workflow broke.\n\n## Lightweight by Default\n\nThe default `decision-only` mode records only branching\npoints (typically 3-8 entries per trace vs 20-50 for\nfull mode). Additional storage hygiene:\n\n- Prune full-mode traces older than 7 days down to\n  decision-only.\n- Cap `alternatives_considered` at 5 entries.\n- Omit `tokens_used` in minimal mode.\n\nFile v1.9.14:skill-card.md\n\n## Description: <br>\nAnalyzes and improves the improvement process for detecting regressions and meta-optimization. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[athola](https://clawhub.ai/user/athola) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and skill maintainers use this skill to review historical improvement outcomes, detect regressions, extract meta-patterns, and propose strategy changes for future skill-improvement cycles. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Local improvement and trace metadata may include sensitive project filenames, tool targets, or decision notes. <br>\nMitigation: Review or disable trace capture for sensitive projects and inspect local metadata stored under ~/.claude/skills before use. <br>\nRisk: Strategy recommendations could introduce incorrect or misleading changes to future skill-improvement workflows. <br>\nMitigation: Treat recommendations as proposals and require user review before modifying the improvement process. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/athola/skills/nm-abstract-metacognitive-self-mod) <br>\n- [OpenClaw homepage](https://github.com/athola/claude-night-market/tree/master/plugins/abstract) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Text, Markdown, Guidance, Shell commands, JSON] <br>\n**Output Format:** [Markdown report with inline shell, Python, and JSON examples] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May read local improvement memory, performance history, and trace metadata under ~/.claude/skills; proposed process changes require user approval.] <br>\n\n## Skill Version(s): <br>\n1.9.14 (source: server release metadata; artifact frontmatter lists 1.9.8) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v1.9.13: 4 files, 7702 bytes\n\nFiles: modules/trace-capture.md (6035b), skill-card.md (2124b), SKILL.md (8366b), _meta.json (154b)\n\nFile v1.9.13:SKILL.md\n\n---\nname: metacognitive-self-mod\ndescription: |\n  Analyze and improve the improvement process. Use for detecting regressions and meta-optimization\nversion: 1.9.8\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/abstract\", \"emoji\": \"\\ud83e\\udd9e\"}}\nsource: claude-night-market\nsource_plugin: abstract\n---\n\n> **Night Market Skill** — ported from [claude-night-market/abstract](https://github.com/athola/claude-night-market/tree/master/plugins/abstract). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n# Metacognitive Self-Modification\n\nAnalyze the effectiveness of past skill improvements and\nrefine the improvement process itself. This is the core\ninnovation from the Hyperagents paper: not just improving\nskills, but improving HOW skills are improved.\n\n## Context Triggers (auto-invocation)\n\nThis skill should be invoked automatically when:\n\n1. **Regression detected**: The homeostatic monitor finds\n   a skill's evaluation window ended in\n   `pending_rollback_review` status. The improvement\n   made things worse -- we need to understand why.\n\n2. **Low effectiveness rate**: When\n   `ImprovementMemory.get_effective_strategies()` vs\n   `get_failed_strategies()` shows effectiveness below\n   50%, the improvement process itself needs refinement.\n\n3. **Degradation despite improvements**: When\n   `PerformanceTracker.get_improvement_trend()` returns\n   negative for a skill that was recently improved.\n\n4. **Periodic check**: After every 10 improvement cycles\n   (tracked via outcome count in ImprovementMemory).\n\n### Hook integration\n\nThe homeostatic monitor emits\n`\"improvement_triggered\": true` when a skill crosses the\nflag threshold. At that point, before dispatching the\nskill-improver, check if metacognitive analysis is\nwarranted:\n\n```python\nfrom abstract.improvement_memory import ImprovementMemory\nfrom pathlib import Path\n\nmemory = ImprovementMemory(\n    Path.home() / \".claude/skills/improvement_memory.json\"\n)\n\n# Check if metacognitive analysis is warranted\neffective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\ntotal = len(effective) + len(failed)\n\nneeds_metacognition = False\n\n# Trigger 1: Low effectiveness rate\nif total >= 5 and len(effective) / total < 0.5:\n    needs_metacognition = True\n\n# Trigger 2: Periodic check (every 10 outcomes)\nif total > 0 and total % 10 == 0:\n    needs_metacognition = True\n\n# Trigger 3: Recent regression\nif failed and failed[-1].get(\"outcome_type\") == \"failure\":\n    needs_metacognition = True\n\nif needs_metacognition:\n    # Run metacognitive analysis before next improvement\n    pass  # Skill(abstract:metacognitive-self-mod)\n```\n\n## When To Use (Manual)\n\n- After a batch of skill improvements to assess what\n  worked\n- When improvement outcomes show regressions\n- Periodically (monthly) to refine improvement strategy\n- When the skill-improver agent seems ineffective\n\n## When NOT To Use\n\n- Routine skill improvements (use skill-improver directly)\n- First-time skill creation (use skill-authoring)\n\n## Workflow\n\n### Step 1: Load improvement data\n\nRead improvement memory and performance tracker data:\n\n```bash\n# Check for improvement memory\nMEMORY_FILE=~/.claude/skills/improvement_memory.json\nTRACKER_FILE=~/.claude/skills/performance_history.json\n\nif [ ! -f \"$MEMORY_FILE\" ]; then\n  echo \"No improvement memory found.\"\n  echo \"Run skill-improver first to generate improvement data.\"\n  exit 0\nfi\n```\n\nLoad the JSON files using Python:\n\n```python\nfrom abstract.improvement_memory import ImprovementMemory\nfrom abstract.performance_tracker import PerformanceTracker\nfrom pathlib import Path\n\nmemory = ImprovementMemory(Path.home() / \".claude/skills/improvement_memory.json\")\ntracker = PerformanceTracker(Path.home() / \".claude/skills/performance_history.json\")\n```\n\n### Step 2: Classify improvement outcomes\n\nFor each improvement outcome in memory, classify:\n\n- **Effective**: `after_score - before_score >= 0.1`\n- **Neutral**: `-0.1 < improvement < 0.1`\n- **Regression**: `after_score < before_score`\n\n```python\neffective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\n\n# Calculate effectiveness rate\ntotal = len(effective) + len(failed)\nif total > 0:\n    effectiveness_rate = len(effective) / total\n```\n\n### Step 3: Extract meta-patterns\n\nAnalyze WHAT types of improvements succeed vs fail:\n\n**Success patterns to look for**:\n\n- Adding error handling (reduces failure rate)\n- Adding examples (improves user ratings)\n- Adding quiet/verbose modes (reduces friction)\n- Simplifying workflow steps (reduces duration)\n\n**Failure patterns to look for**:\n\n- Over-engineering (adding too many options)\n- Breaking existing workflows (regression)\n- Adding complexity without validation\n- Token budget overflow from verbose additions\n\nFor each pattern found, record as a causal hypothesis:\n\n```python\nmemory.record_insight(\n    skill_ref=\"_meta\",  # Special ref for meta-insights\n    category=\"causal_hypothesis\",\n    insight=\"Error handling improvements have 85% success rate\",\n    evidence=[\"skill-A v1.1.0: +0.3\", \"skill-B v2.1.0: +0.15\"]\n)\n```\n\n### Step 4: Analyze improvement trends\n\nUse PerformanceTracker to identify:\n\n- Skills with sustained improvement (positive trend)\n- Skills with degradation despite improvement attempts\n- Domains where improvements are most effective\n\n```python\nfor skill_ref in tracker.get_all_skill_refs():\n    trend = tracker.get_improvement_trend(skill_ref)\n    if trend is not None:\n        if trend > 0.05:\n            # Sustained improvement - what's working?\n            pass\n        elif trend < -0.05:\n            # Degrading despite improvements - investigate\n            pass\n```\n\n### Step 5: Generate strategy recommendations\n\nBased on the meta-analysis, generate recommendations for\nthe skill-improver:\n\n1. **Priority formula adjustments**: If certain issue\n   types have higher improvement success rates, weight\n   them higher.\n\n2. **Approach selection**: If \"add error handling\" has 85%\n   success vs \"restructure workflow\" at 30%, bias toward\n   error handling.\n\n3. **Threshold adjustments**: If improvements below\n   priority 3.0 consistently fail, raise the minimum\n   threshold.\n\n4. **Avoidance rules**: Document anti-patterns to avoid\n   in future improvements.\n\n### Step 6: Store meta-insights\n\nRecord all findings back into ImprovementMemory under the\nspecial `_meta` skill ref:\n\n```python\n# Record strategy recommendation\nmemory.record_insight(\n    skill_ref=\"_meta\",\n    category=\"strategy_success\",\n    insight=\"Recommendation: Prioritize error handling and examples over restructuring\",\n    evidence=[f\"Success rate: error_handling={eh_rate:.0%}, restructure={rs_rate:.0%}\"]\n)\n```\n\n### Step 7: Update skill-improver strategy\n\nIf significant meta-insights are found, propose concrete\nmodifications to the skill-improver agent:\n\n- Update priority weights in the priority formula\n- Add avoidance rules for known anti-patterns\n- Adjust thresholds based on empirical data\n- Add new improvement patterns that proved effective\n\n**Important**: Propose changes, do not auto-apply. The user\nmust approve modifications to the improvement process.\n\n## Output\n\n```\nMetacognitive Self-Modification Report\n\nImprovement Data:\n  Total outcomes analyzed: 15\n  Effective improvements: 11 (73%)\n  Regressions: 2 (13%)\n  Neutral: 2 (13%)\n\nSuccess Patterns:\n  1. Error handling additions: 5/6 success (83%)\n  2. Example additions: 3/3 success (100%)\n  3. Quiet mode additions: 2/2 success (100%)\n\nFailure Patterns:\n  1. Workflow restructuring: 1/3 success (33%)\n  2. Token-heavy additions: 0/1 success (0%)\n\nPerformance Trends:\n  Improving: 8 skills (positive trend)\n  Stable: 4 skills (no trend)\n  Degrading: 1 skill (negative trend despite attempts)\n\nRecommendations:\n  1. Weight error handling improvements 2x in priority\n  2. Avoid workflow restructuring below priority 8.0\n  3. Cap additions at 200 tokens to prevent budget overflow\n  4. Focus next improvement cycle on degrading skill X\n\nMeta-insights stored: 5 new entries in improvement memory\n```\n\n## Related\n\n- `abstract:skill-improver` - The agent this skill analyzes\n  and proposes modifications for\n- `abstract:skills-eval` - Evaluation framework whose\n  criteria could be refined by meta-insights\n- `abstract:aggregate-logs` - Data source for improvement\n  metrics\n\nFile v1.9.13:_meta.json\n\n{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-abstract-metacognitive-self-mod\",\n  \"version\": \"1.9.13\",\n  \"publishedAt\": 1782576865394\n}\n\nFile v1.9.13:modules/trace-capture.md\n\n---\nname: trace-capture\ndescription: >-\n  Execution trace recording for continuous\n  learning. Captures tool sequences, decision\n  points, and outcome attribution.\nparent_skill: abstract:metacognitive-self-mod\ncategory: self-improvement\ntags: [traces, execution-recording, attribution, continuous-learning]\ndependencies: [metacognitive-self-mod]\nestimated_tokens: 200\n---\n\n# Execution Trace Capture\n\nRecord execution traces so that metacognitive-self-mod\ncan analyze concrete decision sequences, not just\naggregate metrics. Inspired by Microsoft Trace\n(AutoDiff-like backward propagation through execution\ntraces), Trajectory-Informed Memory Generation (arXiv\n2603.10600, decision attribution from trajectories),\nand the ACE framework (evolving playbooks via\ngeneration, reflection, and curation).\n\n## Trace Structure\n\nEach trace captures a single skill invocation from start\nto finish. The trace body sits inside the shared\nsession-capture envelope (ADR-0011) so friction signals\nand traces can be consumed through one parser:\n\n```json\n{\n  \"schema_version\": \"session-capture/1\",\n  \"session_id\": \"2026-04-14-abc12345\",\n  \"timestamp\": \"2026-04-14T10:30:00Z\",\n  \"source\": \"trace-capture\",\n  \"payload\": {\n    \"trace_id\": \"session-{date}-{hash}\",\n    \"skill\": \"attune:project-execution\",\n    \"started\": \"2026-04-14T10:30:00Z\",\n    \"completed\": \"2026-04-14T10:32:15Z\",\n    \"outcome\": \"success\",\n    \"capture_mode\": \"decision-only\",\n    \"steps\": [\n      {\n        \"tool\": \"Read\",\n        \"target\": \"src/main.py\",\n        \"purpose\": \"understand entry point\",\n        \"result\": \"success\",\n        \"tokens_used\": 1200,\n        \"decision_point\": false\n      },\n      {\n        \"tool\": \"Edit\",\n        \"target\": \"src/main.py:45\",\n        \"purpose\": \"add error handling\",\n        \"result\": \"success\",\n        \"tokens_used\": 800,\n        \"decision_point\": true,\n        \"alternatives_considered\": [\n          \"try/except\",\n          \"result type\",\n          \"assertion\"\n        ],\n        \"rationale\": \"try/except matches existing patterns\"\n      }\n    ],\n    \"attribution\": {\n      \"success_factors\": [\n        \"followed existing patterns\",\n        \"tested incrementally\"\n      ],\n      \"failure_factors\": [],\n      \"key_decisions\": [\n        \"chose try/except over result type at step 4\"\n      ]\n    }\n  }\n}\n```\n\nLegacy traces written before envelope adoption are read\nas ``session-capture/0`` (entire file treated as the\npayload). See ``docs/adr/0011-session-capture-envelope.md``\nfor the contract and migration path.\n\n## Capture Modes\n\nNot every invocation needs a full trace. Three modes\ncontrol the recording fidelity.\n\n| Mode | Records | When to use |\n|------|---------|-------------|\n| `minimal` | Outcome and duration only | High-trust T3 skills |\n| `decision-only` | Decision points, outcome, duration | Default for all skills |\n| `full` | Every tool call, token counts, all fields | Skills with <85% success rate |\n\n**Mode selection logic:**\n\n- Default: `decision-only` (captures rationale without\n  flooding storage).\n- Enable `full` with `--trace=full` or automatically for\n  any skill whose rolling success rate falls below 85%.\n- Use `minimal` for T3 skills that consistently succeed\n  and need only aggregate trend data.\n\n## What to Capture\n\n- **Tool calls** (full mode only): tool name, target,\n  purpose, result, approximate tokens consumed.\n- **Decision points** (all modes except minimal):\n  alternatives considered (2-5), rationale for the\n  chosen option, whether later revised.\n- **Trace completion** (all modes): overall outcome\n  (`success`/`failure`/`partial`), wall-clock duration,\n  total tokens consumed.\n\n## Attribution Analysis\n\nAfter a trace completes, run backward attribution to\nidentify which decisions drove the outcome. This follows\nthe Microsoft Trace principle of propagating feedback\nbackward through the execution path.\n\n**For successful traces:**\n\n1. Identify decisions that aligned with known success\n   patterns (from `improvement_memory.json`).\n2. Flag novel successful patterns as candidate hypotheses.\n3. Record `success_factors` in the trace's `attribution`\n   block.\n\n**For failed traces:**\n\n1. Walk backward from the failure point.\n2. Identify the earliest decision that diverged from\n   known-good patterns.\n3. Record `failure_factors` and the specific decision.\n4. Generate a causal hypothesis for ImprovementMemory:\n\n```python\nmemory.record_insight(\n    skill_ref=trace[\"skill\"],\n    category=\"causal_hypothesis\",\n    insight=\"Failure correlated with choosing X over Y\",\n    evidence=[f\"trace:{trace['trace_id']}\"]\n)\n```\n\n**Cross-trace pattern detection:**\n\nWhen 5 or more traces exist for a skill, scan for\nrecurring decision-outcome correlations:\n\n- Decisions that appear in >70% of successful traces\n  become \"recommended patterns.\"\n- Decisions that appear in >50% of failed traces become\n  \"anti-patterns.\"\n\n## Storage\n\n| Location | Contents | Retention |\n|----------|----------|-----------|\n| `~/.claude/skills/traces/` | Raw JSON trace files | Rolling 30-day window |\n| `improvement_memory.json` | Aggregate patterns and hypotheses | Persistent |\n\n**Budget:** Maximum 100 trace files, FIFO eviction.\nTraces linked to active causal hypotheses are protected\nuntil the hypothesis is resolved. File naming:\n`{trace_id}.json` (one file per trace).\n\n## Integration Points\n\n- **metacognitive-self-mod** (parent): consumes traces\n  during periodic analysis (Step 3) to inspect specific\n  decisions behind success or failure.\n- **skill-improver**: queries traces for a target skill\n  before proposing changes. Targets recurring failure\n  points directly.\n- **friction-detector**: cross-references friction signals\n  with trace data to pinpoint where a workflow broke.\n\n## Lightweight by Default\n\nThe default `decision-only` mode records only branching\npoints (typically 3-8 entries per trace vs 20-50 for\nfull mode). Additional storage hygiene:\n\n- Prune full-mode traces older than 7 days down to\n  decision-only.\n- Cap `alternatives_considered` at 5 entries.\n- Omit `tokens_used` in minimal mode.\n\nFile v1.9.13:skill-card.md\n\n## Description: <br>\nAnalyze and improve the improvement process for detecting regressions and meta-optimization. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[athola](https://clawhub.ai/user/athola) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and agent maintainers use this skill to analyze skill-improvement outcomes, identify successful and failed modification patterns, and propose refinements to future improvement strategy. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Local trace capture may include project file paths, tool targets, and decision notes. <br>\nMitigation: Use minimal tracing or disable trace capture for sensitive projects, especially when ~/.claude data is synced or backed up. <br>\nRisk: Improvement recommendations may be based on incomplete local outcome data and could introduce ineffective future changes. <br>\nMitigation: Review recommendations before applying them and keep modifications to the improvement process subject to user approval. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/athola/skills/nm-abstract-metacognitive-self-mod) <br>\n- [Project homepage from metadata](https://github.com/athola/claude-night-market/tree/master/plugins/abstract) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance] <br>\n**Output Format:** [Markdown report with inline code and shell command examples] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May include strategy recommendations, causal hypotheses, and trace-capture structures for reviewer-approved follow-up.] <br>\n\n## Skill Version(s): <br>\n1.9.13 (source: server release metadata; artifact frontmatter is 1.9.8) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v1.9.12: 4 files, 7732 bytes\n\nFiles: modules/trace-capture.md (6035b), skill-card.md (2139b), SKILL.md (8366b), _meta.json (154b)\n\nFile v1.9.12:SKILL.md\n\n---\nname: metacognitive-self-mod\ndescription: |\n  Analyze and improve the improvement process. Use for detecting regressions and meta-optimization\nversion: 1.9.8\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/abstract\", \"emoji\": \"\\ud83e\\udd9e\"}}\nsource: claude-night-market\nsource_plugin: abstract\n---\n\n> **Night Market Skill** — ported from [claude-night-market/abstract](https://github.com/athola/claude-night-market/tree/master/plugins/abstract). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n# Metacognitive Self-Modification\n\nAnalyze the effectiveness of past skill improvements and\nrefine the improvement process itself. This is the core\ninnovation from the Hyperagents paper: not just improving\nskills, but improving HOW skills are improved.\n\n## Context Triggers (auto-invocation)\n\nThis skill should be invoked automatically when:\n\n1. **Regression detected**: The homeostatic monitor finds\n   a skill's evaluation window ended in\n   `pending_rollback_review` status. The improvement\n   made things worse -- we need to understand why.\n\n2. **Low effectiveness rate**: When\n   `ImprovementMemory.get_effective_strategies()` vs\n   `get_failed_strategies()` shows effectiveness below\n   50%, the improvement process itself needs refinement.\n\n3. **Degradation despite improvements**: When\n   `PerformanceTracker.get_improvement_trend()` returns\n   negative for a skill that was recently improved.\n\n4. **Periodic check**: After every 10 improvement cycles\n   (tracked via outcome count in ImprovementMemory).\n\n### Hook integration\n\nThe homeostatic monitor emits\n`\"improvement_triggered\": true` when a skill crosses the\nflag threshold. At that point, before dispatching the\nskill-improver, check if metacognitive analysis is\nwarranted:\n\n```python\nfrom abstract.improvement_memory import ImprovementMemory\nfrom pathlib import Path\n\nmemory = ImprovementMemory(\n    Path.home() / \".claude/skills/improvement_memory.json\"\n)\n\n# Check if metacognitive analysis is warranted\neffective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\ntotal = len(effective) + len(failed)\n\nneeds_metacognition = False\n\n# Trigger 1: Low effectiveness rate\nif total >= 5 and len(effective) / total < 0.5:\n    needs_metacognition = True\n\n# Trigger 2: Periodic check (every 10 outcomes)\nif total > 0 and total % 10 == 0:\n    needs_metacognition = True\n\n# Trigger 3: Recent regression\nif failed and failed[-1].get(\"outcome_type\") == \"failure\":\n    needs_metacognition = True\n\nif needs_metacognition:\n    # Run metacognitive analysis before next improvement\n    pass  # Skill(abstract:metacognitive-self-mod)\n```\n\n## When To Use (Manual)\n\n- After a batch of skill improvements to assess what\n  worked\n- When improvement outcomes show regressions\n- Periodically (monthly) to refine improvement strategy\n- When the skill-improver agent seems ineffective\n\n## When NOT To Use\n\n- Routine skill improvements (use skill-improver directly)\n- First-time skill creation (use skill-authoring)\n\n## Workflow\n\n### Step 1: Load improvement data\n\nRead improvement memory and performance tracker data:\n\n```bash\n# Check for improvement memory\nMEMORY_FILE=~/.claude/skills/improvement_memory.json\nTRACKER_FILE=~/.claude/skills/performance_history.json\n\nif [ ! -f \"$MEMORY_FILE\" ]; then\n  echo \"No improvement memory found.\"\n  echo \"Run skill-improver first to generate improvement data.\"\n  exit 0\nfi\n```\n\nLoad the JSON files using Python:\n\n```python\nfrom abstract.improvement_memory import ImprovementMemory\nfrom abstract.performance_tracker import PerformanceTracker\nfrom pathlib import Path\n\nmemory = ImprovementMemory(Path.home() / \".claude/skills/improvement_memory.json\")\ntracker = PerformanceTracker(Path.home() / \".claude/skills/performance_history.json\")\n```\n\n### Step 2: Classify improvement outcomes\n\nFor each improvement outcome in memory, classify:\n\n- **Effective**: `after_score - before_score >= 0.1`\n- **Neutral**: `-0.1 < improvement < 0.1`\n- **Regression**: `after_score < before_score`\n\n```python\neffective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\n\n# Calculate effectiveness rate\ntotal = len(effective) + len(failed)\nif total > 0:\n    effectiveness_rate = len(effective) / total\n```\n\n### Step 3: Extract meta-patterns\n\nAnalyze WHAT types of improvements succeed vs fail:\n\n**Success patterns to look for**:\n\n- Adding error handling (reduces failure rate)\n- Adding examples (improves user ratings)\n- Adding quiet/verbose modes (reduces friction)\n- Simplifying workflow steps (reduces duration)\n\n**Failure patterns to look for**:\n\n- Over-engineering (adding too many options)\n- Breaking existing workflows (regression)\n- Adding complexity without validation\n- Token budget overflow from verbose additions\n\nFor each pattern found, record as a causal hypothesis:\n\n```python\nmemory.record_insight(\n    skill_ref=\"_meta\",  # Special ref for meta-insights\n    category=\"causal_hypothesis\",\n    insight=\"Error handling improvements have 85% success rate\",\n    evidence=[\"skill-A v1.1.0: +0.3\", \"skill-B v2.1.0: +0.15\"]\n)\n```\n\n### Step 4: Analyze improvement trends\n\nUse PerformanceTracker to identify:\n\n- Skills with sustained improvement (positive trend)\n- Skills with degradation despite improvement attempts\n- Domains where improvements are most effective\n\n```python\nfor skill_ref in tracker.get_all_skill_refs():\n    trend = tracker.get_improvement_trend(skill_ref)\n    if trend is not None:\n        if trend > 0.05:\n            # Sustained improvement - what's working?\n            pass\n        elif trend < -0.05:\n            # Degrading despite improvements - investigate\n            pass\n```\n\n### Step 5: Generate strategy recommendations\n\nBased on the meta-analysis, generate recommendations for\nthe skill-improver:\n\n1. **Priority formula adjustments**: If certain issue\n   types have higher improvement success rates, weight\n   them higher.\n\n2. **Approach selection**: If \"add error handling\" has 85%\n   success vs \"restructure workflow\" at 30%, bias toward\n   error handling.\n\n3. **Threshold adjustments**: If improvements below\n   priority 3.0 consistently fail, raise the minimum\n   threshold.\n\n4. **Avoidance rules**: Document anti-patterns to avoid\n   in future improvements.\n\n### Step 6: Store meta-insights\n\nRecord all findings back into ImprovementMemory under the\nspecial `_meta` skill ref:\n\n```python\n# Record strategy recommendation\nmemory.record_insight(\n    skill_ref=\"_meta\",\n    category=\"strategy_success\",\n    insight=\"Recommendation: Prioritize error handling and examples over restructuring\",\n    evidence=[f\"Success rate: error_handling={eh_rate:.0%}, restructure={rs_rate:.0%}\"]\n)\n```\n\n### Step 7: Update skill-improver strategy\n\nIf significant meta-insights are found, propose concrete\nmodifications to the skill-improver agent:\n\n- Update priority weights in the priority formula\n- Add avoidance rules for known anti-patterns\n- Adjust thresholds based on empirical data\n- Add new improvement patterns that proved effective\n\n**Important**: Propose changes, do not auto-apply. The user\nmust approve modifications to the improvement process.\n\n## Output\n\n```\nMetacognitive Self-Modification Report\n\nImprovement Data:\n  Total outcomes analyzed: 15\n  Effective improvements: 11 (73%)\n  Regressions: 2 (13%)\n  Neutral: 2 (13%)\n\nSuccess Patterns:\n  1. Error handling additions: 5/6 success (83%)\n  2. Example additions: 3/3 success (100%)\n  3. Quiet mode additions: 2/2 success (100%)\n\nFailure Patterns:\n  1. Workflow restructuring: 1/3 success (33%)\n  2. Token-heavy additions: 0/1 success (0%)\n\nPerformance Trends:\n  Improving: 8 skills (positive trend)\n  Stable: 4 skills (no trend)\n  Degrading: 1 skill (negative trend despite attempts)\n\nRecommendations:\n  1. Weight error handling improvements 2x in priority\n  2. Avoid workflow restructuring below priority 8.0\n  3. Cap additions at 200 tokens to prevent budget overflow\n  4. Focus next improvement cycle on degrading skill X\n\nMeta-insights stored: 5 new entries in improvement memory\n```\n\n## Related\n\n- `abstract:skill-improver` - The agent this skill analyzes\n  and proposes modifications for\n- `abstract:skills-eval` - Evaluation framework whose\n  criteria could be refined by meta-insights\n- `abstract:aggregate-logs` - Data source for improvement\n  metrics\n\nFile v1.9.12:_meta.json\n\n{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-abstract-metacognitive-self-mod\",\n  \"version\": \"1.9.12\",\n  \"publishedAt\": 1781838450587\n}\n\nFile v1.9.12:modules/trace-capture.md\n\n---\nname: trace-capture\ndescription: >-\n  Execution trace recording for continuous\n  learning. Captures tool sequences, decision\n  points, and outcome attribution.\nparent_skill: abstract:metacognitive-self-mod\ncategory: self-improvement\ntags: [traces, execution-recording, attribution, continuous-learning]\ndependencies: [metacognitive-self-mod]\nestimated_tokens: 200\n---\n\n# Execution Trace Capture\n\nRecord execution traces so that metacognitive-self-mod\ncan analyze concrete decision sequences, not just\naggregate metrics. Inspired by Microsoft Trace\n(AutoDiff-like backward propagation through execution\ntraces), Trajectory-Informed Memory Generation (arXiv\n2603.10600, decision attribution from trajectories),\nand the ACE framework (evolving playbooks via\ngeneration, reflection, and curation).\n\n## Trace Structure\n\nEach trace captures a single skill invocation from start\nto finish. The trace body sits inside the shared\nsession-capture envelope (ADR-0011) so friction signals\nand traces can be consumed through one parser:\n\n```json\n{\n  \"schema_version\": \"session-capture/1\",\n  \"session_id\": \"2026-04-14-abc12345\",\n  \"timestamp\": \"2026-04-14T10:30:00Z\",\n  \"source\": \"trace-capture\",\n  \"payload\": {\n    \"trace_id\": \"session-{date}-{hash}\",\n    \"skill\": \"attune:project-execution\",\n    \"started\": \"2026-04-14T10:30:00Z\",\n    \"completed\": \"2026-04-14T10:32:15Z\",\n    \"outcome\": \"success\",\n    \"capture_mode\": \"decision-only\",\n    \"steps\": [\n      {\n        \"tool\": \"Read\",\n        \"target\": \"src/main.py\",\n        \"purpose\": \"understand entry point\",\n        \"result\": \"success\",\n        \"tokens_used\": 1200,\n        \"decision_point\": false\n      },\n      {\n        \"tool\": \"Edit\",\n        \"target\": \"src/main.py:45\",\n        \"purpose\": \"add error handling\",\n        \"result\": \"success\",\n        \"tokens_used\": 800,\n        \"decision_point\": true,\n        \"alternatives_considered\": [\n          \"try/except\",\n          \"result type\",\n          \"assertion\"\n        ],\n        \"rationale\": \"try/except matches existing patterns\"\n      }\n    ],\n    \"attribution\": {\n      \"success_factors\": [\n        \"followed existing patterns\",\n        \"tested incrementally\"\n      ],\n      \"failure_factors\": [],\n      \"key_decisions\": [\n        \"chose try/except over result type at step 4\"\n      ]\n    }\n  }\n}\n```\n\nLegacy traces written before envelope adoption are read\nas ``session-capture/0`` (entire file treated as the\npayload). See ``docs/adr/0011-session-capture-envelope.md``\nfor the contract and migration path.\n\n## Capture Modes\n\nNot every invocation needs a full trace. Three modes\ncontrol the recording fidelity.\n\n| Mode | Records | When to use |\n|------|---------|-------------|\n| `minimal` | Outcome and duration only | High-trust T3 skills |\n| `decision-only` | Decision points, outcome, duration | Default for all skills |\n| `full` | Every tool call, token counts, all fields | Skills with <85% success rate |\n\n**Mode selection logic:**\n\n- Default: `decision-only` (captures rationale without\n  flooding storage).\n- Enable `full` with `--trace=full` or automatically for\n  any skill whose rolling success rate falls below 85%.\n- Use `minimal` for T3 skills that consistently succeed\n  and need only aggregate trend data.\n\n## What to Capture\n\n- **Tool calls** (full mode only): tool name, target,\n  purpose, result, approximate tokens consumed.\n- **Decision points** (all modes except minimal):\n  alternatives considered (2-5), rationale for the\n  chosen option, whether later revised.\n- **Trace completion** (all modes): overall outcome\n  (`success`/`failure`/`partial`), wall-clock duration,\n  total tokens consumed.\n\n## Attribution Analysis\n\nAfter a trace completes, run backward attribution to\nidentify which decisions drove the outcome. This follows\nthe Microsoft Trace principle of propagating feedback\nbackward through the execution path.\n\n**For successful traces:**\n\n1. Identify decisions that aligned with known success\n   patterns (from `improvement_memory.json`).\n2. Flag novel successful patterns as candidate hypotheses.\n3. Record `success_factors` in the trace's `attribution`\n   block.\n\n**For failed traces:**\n\n1. Walk backward from the failure point.\n2. Identify the earliest decision that diverged from\n   known-good patterns.\n3. Record `failure_factors` and the specific decision.\n4. Generate a causal hypothesis for ImprovementMemory:\n\n```python\nmemory.record_insight(\n    skill_ref=trace[\"skill\"],\n    category=\"causal_hypothesis\",\n    insight=\"Failure correlated with choosing X over Y\",\n    evidence=[f\"trace:{trace['trace_id']}\"]\n)\n```\n\n**Cross-trace pattern detection:**\n\nWhen 5 or more traces exist for a skill, scan for\nrecurring decision-outcome correlations:\n\n- Decisions that appear in >70% of successful traces\n  become \"recommended patterns.\"\n- Decisions that appear in >50% of failed traces become\n  \"anti-patterns.\"\n\n## Storage\n\n| Location | Contents | Retention |\n|----------|----------|-----------|\n| `~/.claude/skills/traces/` | Raw JSON trace files | Rolling 30-day window |\n| `improvement_memory.json` | Aggregate patterns and hypotheses | Persistent |\n\n**Budget:** Maximum 100 trace files, FIFO eviction.\nTraces linked to active causal hypotheses are protected\nuntil the hypothesis is resolved. File naming:\n`{trace_id}.json` (one file per trace).\n\n## Integration Points\n\n- **metacognitive-self-mod** (parent): consumes traces\n  during periodic analysis (Step 3) to inspect specific\n  decisions behind success or failure.\n- **skill-improver**: queries traces for a target skill\n  before proposing changes. Targets recurring failure\n  points directly.\n- **friction-detector**: cross-references friction signals\n  with trace data to pinpoint where a workflow broke.\n\n## Lightweight by Default\n\nThe default `decision-only` mode records only branching\npoints (typically 3-8 entries per trace vs 20-50 for\nfull mode). Additional storage hygiene:\n\n- Prune full-mode traces older than 7 days down to\n  decision-only.\n- Cap `alternatives_considered` at 5 entries.\n- Omit `tokens_used` in minimal mode.\n\nFile v1.9.12:skill-card.md\n\n## Description: <br>\nAnalyze and improve the improvement process for agent skills by detecting regressions, extracting meta-patterns from prior outcomes, and recommending strategy adjustments. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[athola](https://clawhub.ai/user/athola) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and agent operators use this skill after batches of skill improvements, regressions, or periodic review cycles to assess what worked and refine future improvement strategy. It helps summarize improvement outcomes, identify success and failure patterns, and propose changes for human approval. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Persistent local trace logging can retain tool targets, decision rationale, outcomes, and improvement patterns that may include sensitive project context. <br>\nMitigation: Use only in workspaces where trace logging is acceptable, and periodically review or delete ~/.claude/skills/traces/ and improvement_memory.json when sensitive context may have been captured. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/athola/nm-abstract-metacognitive-self-mod) <br>\n- [Metadata homepage](https://github.com/athola/claude-night-market/tree/master/plugins/abstract) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Text, Markdown, Guidance, Code, Shell commands, Configuration] <br>\n**Output Format:** [Markdown report with recommendations, metrics, and inline code or shell examples] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May record meta-insights and trace-derived findings in local improvement memory when the workflow is followed.] <br>\n\n## Skill Version(s): <br>\n1.9.12 (source: server release evidence) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v1.8.6: 4 files, 7676 bytes\n\nFiles: modules/trace-capture.md (6035b), skill-card.md (2073b), SKILL.md (8366b), _meta.json (153b)\n\nFile v1.8.6:SKILL.md\n\n---\nname: metacognitive-self-mod\ndescription: |\n  Analyze and improve the improvement process. Use for detecting regressions and meta-optimization\nversion: 1.9.8\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/abstract\", \"emoji\": \"\\ud83e\\udd9e\"}}\nsource: claude-night-market\nsource_plugin: abstract\n---\n\n> **Night Market Skill** — ported from [claude-night-market/abstract](https://github.com/athola/claude-night-market/tree/master/plugins/abstract). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n# Metacognitive Self-Modification\n\nAnalyze the effectiveness of past skill improvements and\nrefine the improvement process itself. This is the core\ninnovation from the Hyperagents paper: not just improving\nskills, but improving HOW skills are improved.\n\n## Context Triggers (auto-invocation)\n\nThis skill should be invoked automatically when:\n\n1. **Regression detected**: The homeostatic monitor finds\n   a skill's evaluation window ended in\n   `pending_rollback_review` status. The improvement\n   made things worse -- we need to understand why.\n\n2. **Low effectiveness rate**: When\n   `ImprovementMemory.get_effective_strategies()` vs\n   `get_failed_strategies()` shows effectiveness below\n   50%, the improvement process itself needs refinement.\n\n3. **Degradation despite improvements**: When\n   `PerformanceTracker.get_improvement_trend()` returns\n   negative for a skill that was recently improved.\n\n4. **Periodic check**: After every 10 improvement cycles\n   (tracked via outcome count in ImprovementMemory).\n\n### Hook integration\n\nThe homeostatic monitor emits\n`\"improvement_triggered\": true` when a skill crosses the\nflag threshold. At that point, before dispatching the\nskill-improver, check if metacognitive analysis is\nwarranted:\n\n```python\nfrom abstract.improvement_memory import ImprovementMemory\nfrom pathlib import Path\n\nmemory = ImprovementMemory(\n    Path.home() / \".claude/skills/improvement_memory.json\"\n)\n\n# Check if metacognitive analysis is warranted\neffective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\ntotal = len(effective) + len(failed)\n\nneeds_metacognition = False\n\n# Trigger 1: Low effectiveness rate\nif total >= 5 and len(effective) / total < 0.5:\n    needs_metacognition = True\n\n# Trigger 2: Periodic check (every 10 outcomes)\nif total > 0 and total % 10 == 0:\n    needs_metacognition = True\n\n# Trigger 3: Recent regression\nif failed and failed[-1].get(\"outcome_type\") == \"failure\":\n    needs_metacognition = True\n\nif needs_metacognition:\n    # Run metacognitive analysis before next improvement\n    pass  # Skill(abstract:metacognitive-self-mod)\n```\n\n## When To Use (Manual)\n\n- After a batch of skill improvements to assess what\n  worked\n- When improvement outcomes show regressions\n- Periodically (monthly) to refine improvement strategy\n- When the skill-improver agent seems ineffective\n\n## When NOT To Use\n\n- Routine skill improvements (use skill-improver directly)\n- First-time skill creation (use skill-authoring)\n\n## Workflow\n\n### Step 1: Load improvement data\n\nRead improvement memory and performance tracker data:\n\n```bash\n# Check for improvement memory\nMEMORY_FILE=~/.claude/skills/improvement_memory.json\nTRACKER_FILE=~/.claude/skills/performance_history.json\n\nif [ ! -f \"$MEMORY_FILE\" ]; then\n  echo \"No improvement memory found.\"\n  echo \"Run skill-improver first to generate improvement data.\"\n  exit 0\nfi\n```\n\nLoad the JSON files using Python:\n\n```python\nfrom abstract.improvement_memory import ImprovementMemory\nfrom abstract.performance_tracker import PerformanceTracker\nfrom pathlib import Path\n\nmemory = ImprovementMemory(Path.home() / \".claude/skills/improvement_memory.json\")\ntracker = PerformanceTracker(Path.home() / \".claude/skills/performance_history.json\")\n```\n\n### Step 2: Classify improvement outcomes\n\nFor each improvement outcome in memory, classify:\n\n- **Effective**: `after_score - before_score >= 0.1`\n- **Neutral**: `-0.1 < improvement < 0.1`\n- **Regression**: `after_score < before_score`\n\n```python\neffective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\n\n# Calculate effectiveness rate\ntotal = len(effective) + len(failed)\nif total > 0:\n    effectiveness_rate = len(effective) / total\n```\n\n### Step 3: Extract meta-patterns\n\nAnalyze WHAT types of improvements succeed vs fail:\n\n**Success patterns to look for**:\n\n- Adding error handling (reduces failure rate)\n- Adding examples (improves user ratings)\n- Adding quiet/verbose modes (reduces friction)\n- Simplifying workflow steps (reduces duration)\n\n**Failure patterns to look for**:\n\n- Over-engineering (adding too many options)\n- Breaking existing workflows (regression)\n- Adding complexity without validation\n- Token budget overflow from verbose additions\n\nFor each pattern found, record as a causal hypothesis:\n\n```python\nmemory.record_insight(\n    skill_ref=\"_meta\",  # Special ref for meta-insights\n    category=\"causal_hypothesis\",\n    insight=\"Error handling improvements have 85% success rate\",\n    evidence=[\"skill-A v1.1.0: +0.3\", \"skill-B v2.1.0: +0.15\"]\n)\n```\n\n### Step 4: Analyze improvement trends\n\nUse PerformanceTracker to identify:\n\n- Skills with sustained improvement (positive trend)\n- Skills with degradation despite improvement attempts\n- Domains where improvements are most effective\n\n```python\nfor skill_ref in tracker.get_all_skill_refs():\n    trend = tracker.get_improvement_trend(skill_ref)\n    if trend is not None:\n        if trend > 0.05:\n            # Sustained improvement - what's working?\n            pass\n        elif trend < -0.05:\n            # Degrading despite improvements - investigate\n            pass\n```\n\n### Step 5: Generate strategy recommendations\n\nBased on the meta-analysis, generate recommendations for\nthe skill-improver:\n\n1. **Priority formula adjustments**: If certain issue\n   types have higher improvement success rates, weight\n   them higher.\n\n2. **Approach selection**: If \"add error handling\" has 85%\n   success vs \"restructure workflow\" at 30%, bias toward\n   error handling.\n\n3. **Threshold adjustments**: If improvements below\n   priority 3.0 consistently fail, raise the minimum\n   threshold.\n\n4. **Avoidance rules**: Document anti-patterns to avoid\n   in future improvements.\n\n### Step 6: Store meta-insights\n\nRecord all findings back into ImprovementMemory under the\nspecial `_meta` skill ref:\n\n```python\n# Record strategy recommendation\nmemory.record_insight(\n    skill_ref=\"_meta\",\n    category=\"strategy_success\",\n    insight=\"Recommendation: Prioritize error handling and examples over restructuring\",\n    evidence=[f\"Success rate: error_handling={eh_rate:.0%}, restructure={rs_rate:.0%}\"]\n)\n```\n\n### Step 7: Update skill-improver strategy\n\nIf significant meta-insights are fou\n\nArchive v1.8.5: 3 files, 4843 bytes\n\nFiles: skill-card.md (2227b), SKILL.md (8383b), _meta.json (153b)","readmeExcerpt":"Skill: metacognitive-self-mod Owner: athola Summary: Analyze and improve the improvement process. Use for detecting regressions and meta-optimization Tags: latest:1.9.19 Version history: v1.9.19 | 2026-08-26T13:03:18.787Z | user Release v1.9.19 v1.9.18 | 2026-08-15T21:27:47.174Z | user Release v1.9.18 v1.9.17 | 2026-07-30T05:27:40.802Z | user Release v1.9.17 v1.9.16 | 2026-07-14T19:44:34.348Z | user Release v1.9.16 v","codeSnippets":[],"executableExamples":[{"language":"python","snippet":"from abstract.improvement_memory import ImprovementMemory\nfrom pathlib import Path\n\nmemory = ImprovementMemory(\n    Path.home() / \".claude/skills/improvement_memory.json\"\n)\n\n# Check if metacognitive analysis is warranted\neffective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\ntotal = len(effective) + len(failed)\n\nneeds_metacognition = False\n\n# Trigger 1: Low effectiveness rate\nif total >= 5 and len(effective) / total < 0.5:\n    needs_metacognition = True\n\n# Trigger 2: Periodic check (every 10 outcomes)\nif total > 0 and total % 10 == 0:\n    needs_metacognition = True\n\n# Trigger 3: Recent regression\nif failed and failed[-1].get(\"outcome_type\") == \"failure\":\n    needs_metacognition = True\n\nif needs_metacognition:\n    # Run metacognitive analysis before next improvement\n    pass  # Skill(abstract:metacognitive-self-mod)"},{"language":"bash","snippet":"# Check for improvement memory\nMEMORY_FILE=~/.claude/skills/improvement_memory.json\nTRACKER_FILE=~/.claude/skills/performance_history.json\n\nif [ ! -f \"$MEMORY_FILE\" ]; then\n  echo \"No improvement memory found.\"\n  echo \"Run skill-improver first to generate improvement data.\"\n  exit 0\nfi"},{"language":"python","snippet":"from abstract.improvement_memory import ImprovementMemory\nfrom abstract.performance_tracker import PerformanceTracker\nfrom pathlib import Path\n\nmemory = ImprovementMemory(Path.home() / \".claude/skills/improvement_memory.json\")\ntracker = PerformanceTracker(Path.home() / \".claude/skills/performance_history.json\")"},{"language":"python","snippet":"effective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\n\n# Calculate effectiveness rate\ntotal = len(effective) + len(failed)\nif total > 0:\n    effectiveness_rate = len(effective) / total"},{"language":"python","snippet":"memory.record_insight(\n    skill_ref=\"_meta\",  # Special ref for meta-insights\n    category=\"causal_hypothesis\",\n    insight=\"Error handling improvements have 85% success rate\",\n    evidence=[\"skill-A v1.1.0: +0.3\", \"skill-B v2.1.0: +0.15\"]\n)"},{"language":"python","snippet":"for skill_ref in tracker.get_all_skill_refs():\n    trend = tracker.get_improvement_trend(skill_ref)\n    if trend is not None:\n        if trend > 0.05:\n            # Sustained improvement - what's working?\n            pass\n        elif trend < -0.05:\n            # Degrading despite improvements - investigate\n            pass"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: metacognitive-self-mod\ndescription: |\n  Analyze and improve the improvement process. Use for detecting regressions and meta-optimization\nversion: 1.9.8\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/abstract\", \"emoji\": \"\\ud83e\\udd9e\"}}\nsource: claude-night-market\nsource_plugin: abstract\n---\n\n> **Night Market Skill** — ported from [claude-night-market/abstract](https://github.com/athola/claude-night-market/tree/master/plugins/abstract). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n# Metacognitive Self-Modification\n\nAnalyze the effectiveness of past skill improvements and\nrefine the improvement process itself. This is the core\ninnovation from the Hyperagents paper: not just improving\nskills, but improving HOW skills are improved.\n\n## Context Triggers (auto-invocation)\n\nThis skill should be invoked automatically when:\n\n1. **Regression detected**: The homeostatic monitor finds\n   a skill's evaluation window ended in\n   `pending_rollback_review` status. The improvement\n   made things worse -- we need to understand why.\n\n2. **Low effectiveness rate**: When\n   `ImprovementMemory.get_effective_strategies()` vs\n   `get_failed_strategies()` shows effectiveness below\n   50%, the improvement process itself needs refinement.\n\n3. **Degradation despite improvements**: When\n   `PerformanceTracker.get_improvement_trend()` returns\n   negative for a skill that was recently improved.\n\n4. **Periodic check**: After every 10 improvement cycles\n   (tracked via outcome count in ImprovementMemory).\n\n### Hook integration\n\nThe homeostatic monitor emits\n`\"improvement_triggered\": true` when a skill crosses the\nflag threshold. At that point, before dispatching the\nskill-improver, check if metacognitive analysis is\nwarranted:\n\n```python\nfrom abstract.improvement_memory import ImprovementMemory\nfrom pathlib import Path\n\nmemory = ImprovementMemory(\n    Path.home() / \".claude/skills/improvement_memory.json\"\n)\n\n# Check if metacognitive analysis is warranted\neffective = memory.get_effective_strategies()\nfailed = memory.get_failed_strategies()\ntotal = len(effective) + len(failed)\n\nneeds_metacognition = False\n\n# Trigger 1: Low effectiveness rate\nif total >= 5 and len(effective) / total < 0.5:\n    needs_metacognition = True\n\n# Trigger 2: Periodic check (every 10 outcomes)\nif total > 0 and total % 10 == 0:\n    needs_metacognition = True\n\n# Trigger 3: Recent regression\nif failed and failed[-1].get(\"outcome_type\") == \"failure\":\n    needs_metacognition = True\n\nif needs_metacognition:\n    # Run metacognitive analysis before next improvement\n    pass  # Skill(abstract:metacognitive-self-mod)\n```\n\n## When To Use (Manual)\n\n- After a batch of skill improvements to assess what\n  worked\n- When improvement outcomes show regressions\n- Periodically (monthly) to refine improvement strategy\n- When the skill-improver agent seems ineffective\n\n## When NOT To Use\n\n- Routine skill improvements ("},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-abstract-metacognitive-self-mod\",\n  \"version\": \"1.9.19\",\n  \"publishedAt\": 1787749398787\n}"},{"path":"modules/trace-capture.md","content":"---\nname: trace-capture\ndescription: >-\n  Execution trace recording for continuous\n  learning. Captures tool sequences, decision\n  points, and outcome attribution.\nparent_skill: abstract:metacognitive-self-mod\ncategory: self-improvement\ntags: [traces, execution-recording, attribution, continuous-learning]\ndependencies: [metacognitive-self-mod]\nestimated_tokens: 200\n---\n\n# Execution Trace Capture\n\nRecord execution traces so that metacognitive-self-mod\ncan analyze concrete decision sequences, not just\naggregate metrics. Inspired by Microsoft Trace\n(AutoDiff-like backward propagation through execution\ntraces), Trajectory-Informed Memory Generation (arXiv\n2603.10600, decision attribution from trajectories),\nand the ACE framework (evolving playbooks via\ngeneration, reflection, and curation).\n\n## Trace Structure\n\nEach trace captures a single skill invocation from start\nto finish. The trace body sits inside the shared\nsession-capture envelope (ADR-0011) so friction signals\nand traces can be consumed through one parser:\n\n```json\n{\n  \"schema_version\": \"session-capture/1\",\n  \"session_id\": \"2026-04-14-abc12345\",\n  \"timestamp\": \"2026-04-14T10:30:00Z\",\n  \"source\": \"trace-capture\",\n  \"payload\": {\n    \"trace_id\": \"session-{date}-{hash}\",\n    \"skill\": \"attune:project-execution\",\n    \"started\": \"2026-04-14T10:30:00Z\",\n    \"completed\": \"2026-04-14T10:32:15Z\",\n    \"outcome\": \"success\",\n    \"capture_mode\": \"decision-only\",\n    \"steps\": [\n      {\n        \"tool\": \"Read\",\n        \"target\": \"src/main.py\",\n        \"purpose\": \"understand entry point\",\n        \"result\": \"success\",\n        \"tokens_used\": 1200,\n        \"decision_point\": false\n      },\n      {\n        \"tool\": \"Edit\",\n        \"target\": \"src/main.py:45\",\n        \"purpose\": \"add error handling\",\n        \"result\": \"success\",\n        \"tokens_used\": 800,\n        \"decision_point\": true,\n        \"alternatives_considered\": [\n          \"try/except\",\n          \"result type\",\n          \"assertion\"\n        ],\n        \"rationale\": \"try/except matches existing patterns\"\n      }\n    ],\n    \"attribution\": {\n      \"success_factors\": [\n        \"followed existing patterns\",\n        \"tested incrementally\"\n      ],\n      \"failure_factors\": [],\n      \"key_decisions\": [\n        \"chose try/except over result type at step 4\"\n      ]\n    }\n  }\n}\n```\n\nLegacy traces written before envelope adoption are read\nas ``session-capture/0`` (entire file treated as the\npayload). See ``docs/adr/0011-session-capture-envelope.md``\nfor the contract and migration path.\n\n## Capture Modes\n\nNot every invocation needs a full trace. Three modes\ncontrol the recording fidelity.\n\n| Mode | Records | When to use |\n|------|---------|-------------|\n| `minimal` | Outcome and duration only | High-trust T3 skills |\n| `decision-only` | Decision points, outcome, duration | Default for all skills |\n| `full` | Every tool call, token counts, all fields | Skills with <85% success rate |\n\n**Mode selection logic:**\n\n- Default: `decision-only` (captures rationale without\n  fl"},{"path":"skill-card.md","content":"## Description:\n\nAnalyze and improve the improvement process for detecting regressions and meta-optimization.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[athola](https://clawhub.ai/user/athola)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and agent maintainers use this skill to analyze skill-improvement outcomes, detect regressions, extract success and failure patterns, and propose changes to future improvement strategy.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Persistent execution traces and aggregate learning data may retain sensitive paths, project details, tool sequences, or decision rationale.\n\nMitigation: Confirm how trace capture is enabled, redact sensitive paths and project details, and document how traces and persistent memory can be disabled or deleted.\n\nRisk: Generated recommendations could incorrectly alter future skill-improvement behavior if applied without review.\n\nMitigation: Review recommendations and require explicit user approval before modifying the improvement process.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/athola/skills/nm-abstract-metacognitive-self-mod)\n- [Clawdis homepage](https://github.com/athola/claude-night-market/tree/master/plugins/abstract)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown report with inline code and shell command examples]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May propose changes to improvement strategy; artifact guidance says user approval is required before applying modifications.]\n\n## Skill Version(s):\n\n1.9.19 (source: ClawHub release evidence; artifact frontmatter lists 1.9.8)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment."}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":"Analyze and improve the improvement process. Use for detecting regressions and meta-optimization Skill: metacognitive-self-mod Owner: athola Summary: Analyze and improve the improvement process. Use for detecting regressions and meta-optimization Tags: latest:1.9.19 Version history: v1.9.19 | 2026-08-26T13:03:18.787Z | user Release v1.9.19 v1.9.18 | 2026-08-15T21:27:47.174Z | user Release v1.9.18 v1.9.17 | 2026-07-30T05:27:40.802Z | user Release v1.9.17 v1.9.16 | 2026-07-14T19:44:34.348Z | user Release v1.9.16 v","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":1162,"uniquenessScore":55,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-10T00:30:56.840Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-10T00:30:56.840Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-10T07:53:04.374Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}