Skip to content

Commit 060b895

Browse files
ANcpLuaclaude
andauthored
feat: metacognitive-guard v0.5.0 + design-studio plugin (#154)
* feat: add design-studio plugin (merges frontend-design + ui-ux-pro-max) Combines Anthropic's frontend-design creative philosophy with ui-ux-pro-max's data-driven search engine into a single unified plugin. Single workflow: creative direction -> design system generation -> domain/stack searches -> implementation with aesthetic precision. - 50 styles, 97 palettes, 57 font pairings, 99 UX guidelines, 25 chart types - 13 framework stacks (React, Next.js, Vue, Svelte, Flutter, etc.) - BM25 search engine with design system generator (Python stdlib-only) - Pre-delivery checklist with creative distinctiveness check - Master + Overrides persistence pattern for multi-session projects Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(metacognitive-guard): agent_type filtering, InstructionsLoaded hook, git instructions opt-out - Add agent_type=subagent early exit to struggle-detector.sh and ralph-loop.sh - Add InstructionsLoaded hook firing truth-beacon after CLAUDE.md/rules load - Add includeGitInstructions: false in .claude/settings.json (saves ~2K tokens/turn) - Update truth-beacon with new Claude Code conventions (CLAUDE_SKILL_DIR, /reload-plugins, agent_type) - Soften CLAUDE.md version bump docs to mention /reload-plugins for dev workflows - Bump metacognitive-guard 0.4.5 -> 0.5.0 --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f99a002 commit 060b895

File tree

9 files changed

+37
-4
lines changed

9 files changed

+37
-4
lines changed

.claude/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"includeGitInstructions": false
3+
}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ and the project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
88

99
### Added
1010

11+
- **metacognitive-guard `InstructionsLoaded` hook**: Truth beacon now fires on both SessionStart AND InstructionsLoaded — ground truth re-injected when CLAUDE.md/rules are loaded, ensuring authoritative facts arrive after instructions context
12+
- **metacognitive-guard `agent_type` filtering**: Struggle detector and Ralph Loop now skip subagents via `agent_type` field in hook events — prevents wasted haiku calls and false positives from subagent responses
1113
- **`design-studio` plugin (1.0.0)**: Design intelligence studio merging creative direction with data-driven recommendations. Combines `frontend-design` (Anthropic plugin — bold aesthetic philosophy, anti-generic guidelines) with `ui-ux-pro-max` (local skill — BM25 search engine, 750+ CSV rows, design system generator). Single unified workflow: creative direction → `--design-system` CLI → domain/stack searches → implementation with aesthetic precision. 50 styles, 97 palettes, 57 font pairings, 99 UX guidelines, 25 chart types, 13 stacks. Pre-delivery checklist includes creative distinctiveness check. Python stdlib-only, no pip dependencies
1214

1315
### Added
@@ -17,6 +19,9 @@ and the project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
1719

1820
### Changed
1921

22+
- **`includeGitInstructions: false`**: Disabled built-in git instructions in `.claude/settings.json` — we have our own commit/PR workflows in CLAUDE.md, saves ~2K tokens/turn
23+
- **CLAUDE.md version bump docs**: Softened "DO NOT SKIP" to acknowledge `/reload-plugins` for dev workflows while keeping version bumps mandatory for releases
24+
- **metacognitive-guard (0.4.5 → 0.5.0)**: InstructionsLoaded hook + agent_type filtering
2025
- **`claude-self-obs` (2.0.0 → 3.0.0)**: Deleted standalone TypeScript MCP server — qyl.mcp already provides `qyl.claude_code_sessions`, `qyl.claude_code_timeline`, `qyl.claude_code_tools`. Plugin is now 38 lines of declarative JSON: HTTP hooks POST raw event JSON to `qyl.collector:5100/api/v1/claude-code/hooks`. Zero TypeScript, zero npm, zero processes to manage
2126
- **`claude-self-obs` (1.0.0 → 2.0.0)**: Complete rewrite from bash/jq/curl hooks to HTTP hooks + MCP server. Deleted 210 lines of shell scripts (emit-span.sh, emit-agent-start.sh, emit-agent-stop.sh). Replaced with `type: "http"` hooks that POST directly to a dual-mode MCP server (stdio for Claude tools + HTTP for hook events). Claude can now query its own telemetry via 4 MCP tools: `get_status`, `get_session_timeline`, `get_tool_stats`, `search_events`. In-memory ring buffer stores last 10k events per session
2227
- **`marketplace.json`**: Added claude-self-obs to registry, updated plugin count (9 → 10) and command count (24 → 25)

CLAUDE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,15 +463,16 @@ For EVERY non-trivial change:
463463

464464
**NO EXCEPTIONS.** Forgetting to update CHANGELOG = incomplete task.
465465

466-
### ⚠️ PLUGIN VERSION BUMP - DO NOT SKIP
466+
### ⚠️ PLUGIN VERSION BUMP
467467

468468
**When you modify a plugin's code (hooks, commands, skills, agents), you MUST bump its version:**
469469

470470
1. Open `plugins/<name>/.claude-plugin/plugin.json`
471471
2. Increment the `version` field (patch for fixes, minor for features)
472472
3. The plugin cache (`~/.claude/plugins/cache/`) is version-keyed — without a bump, new sessions won't pick up changes
473473

474-
**NO EXCEPTIONS.** Changed plugin code without version bump = users stuck on stale cache.
474+
**During development:** Use `/reload-plugins` to activate changes in the current session without bumping.
475+
**For releases:** Version bump is mandatory — other users' sessions won't pick up changes without it.
475476

476477
</EXTREMELY_IMPORTANT>
477478

plugins/metacognitive-guard/.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "metacognitive-guard",
33
"description": "Cognitive amplification stack: epistemic hooks, competitive review, commit integrity checks, CI verification scripts, and deep-thinking agents.",
4-
"version": "0.4.5",
4+
"version": "0.5.0",
55
"author": {
66
"name": "AncpLua",
77
"url": "https://github.com/ANcpLua"

plugins/metacognitive-guard/CLAUDE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ agents amplify thinking. Absorbs completion-integrity and autonomous-ci.
77

88
| Hook | Event | Script | Purpose |
99
|------|-------|--------|---------|
10-
| Truth Beacon | SessionStart | `truth-beacon.sh` | Injects `blackboard/assertions.yaml` as authoritative facts |
10+
| Truth Beacon | SessionStart + InstructionsLoaded | `truth-beacon.sh` | Injects `blackboard/assertions.yaml` as authoritative facts |
1111
| Epistemic Guard | PreToolUse (Write/Edit) | `epistemic-guard.sh` | Blocks writes with wrong versions, banned APIs, AGENTS.md in plugins |
1212
| Commit Integrity | PreToolUse (Bash) | `commit-integrity-hook.sh` | Blocks `git commit` with suppressions, commented tests, deleted assertions |
1313
| Struggle Detector | Stop (async) | `struggle-detector.sh` | Scores response for uncertainty, writes to blackboard |
@@ -56,6 +56,7 @@ agents amplify thinking. Absorbs completion-integrity and autonomous-ci.
5656
- Struggle detector is a two-part system: Stop hook (async) does analysis + blackboard writes,
5757
UserPromptSubmit hook reads blackboard and injects `additionalContext` so Claude actually sees the
5858
suggestion. No latency on responses.
59+
- Struggle detector and Ralph Loop skip subagents via `agent_type` filtering (only lead agent matters).
5960
- TaskCompleted prompt hook fires on every task completion in team contexts (haiku, 15s timeout).
6061
- Ralph Loop fires PostToolUse on Write/Edit — two layers run in parallel:
6162
(1) Haiku prompt analyzes context for deep drift (over-engineering, complexity creep, premature

plugins/metacognitive-guard/hooks/hooks.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@
1212
]
1313
}
1414
],
15+
"InstructionsLoaded": [
16+
{
17+
"hooks": [
18+
{
19+
"type": "command",
20+
"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/scripts/truth-beacon.sh",
21+
"timeout": 5,
22+
"statusMessage": "Re-injecting ground truth after instructions loaded..."
23+
}
24+
]
25+
}
26+
],
1527
"PreToolUse": [
1628
{
1729
"matcher": "Write|Edit",

plugins/metacognitive-guard/hooks/scripts/ralph-loop.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ INPUT=$(cat 2>/dev/null || true)
2020
# Requires jq for JSON parsing
2121
command -v jq &>/dev/null || exit 0
2222

23+
# Skip subagents — drift detection only matters for the lead agent
24+
AGENT_TYPE=$(echo "$INPUT" | jq -r '.agent_type // empty' 2>/dev/null)
25+
[[ "$AGENT_TYPE" == "subagent" ]] && exit 0
26+
2327
# Extract both fields in a single jq call
2428
eval "$(echo "$INPUT" | jq -r '
2529
"FILE_PATH=" + (.tool_input.file_path // .tool_input.file // "" | @sh) +

plugins/metacognitive-guard/hooks/scripts/struggle-detector.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ mkdir -p "$BLACKBOARD" 2>/dev/null || true
3636
INPUT=$(cat 2>/dev/null || true)
3737
[[ -z "$INPUT" ]] && exit 0
3838

39+
# Skip subagents — only analyze the lead agent's responses
40+
AGENT_TYPE=$(echo "$INPUT" | jq -r '.agent_type // empty' 2>/dev/null)
41+
[[ "$AGENT_TYPE" == "subagent" ]] && exit 0
42+
3943
# Extract transcript path from hook input
4044
TRANSCRIPT=$(echo "$INPUT" | jq -r '.transcript_path // empty' 2>/dev/null)
4145
[[ -z "$TRANSCRIPT" || ! -f "$TRANSCRIPT" ]] && exit 0

plugins/metacognitive-guard/hooks/scripts/truth-beacon.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ CLAUDE CODE CONVENTIONS:
6060
- AGENTS.md is NOT auto-loaded by plugins (dead weight - use skill descriptions)
6161
- hooks/hooks.json auto-loads by convention (do NOT declare in plugin.json)
6262
- Passive context = CLAUDE.md + skill description frontmatter + SessionStart hooks
63+
- Use \${CLAUDE_SKILL_DIR} for skill-local resources, \${CLAUDE_PLUGIN_ROOT} for plugin-wide
64+
- /reload-plugins activates plugin changes without restart (no version bump needed during dev)
65+
- Hook events include agent_id and agent_type — filter subagents to avoid wasted work
6366
6467
If uncertain about versions/APIs:
6568
- WebSearch to verify current state

0 commit comments

Comments
 (0)