From second-brain
Show second-brain hot-tier and wiki health at a glance. Reports USER.md size, active PROJECT.md size, projects.jsonl project count, wiki page counts per category, and index.md status.
npx claudepluginhub cain-ish/claude-code-plugin --plugin second-brainThis skill is limited to using the following tools:
<!-- user instruction verbatim: "1" -->
Mandates invoking relevant skills via tools before any response in coding sessions. Covers access, priorities, and adaptations for Claude Code, Copilot CLI, Gemini CLI.
Share bugs, ideas, or general feedback.
Show a compact dashboard of the v1.0 second-brain state: the hot tier (USER.md + active PROJECT.md + projects.jsonl) plus the cold tier (wiki page counts per category).
SLUG=$(basename "$(git rev-parse --show-toplevel 2>/dev/null || pwd)")
echo "Active project: $SLUG"
Report byte counts for each hot-tier file. The combined target is ≤ ~3200 bytes (≈ 800 tokens).
USER_FILE=~/.second-brain/USER.md
PROJECT_FILE=~/.second-brain/projects/"$SLUG"/PROJECT.md
INDEX_FILE=~/.second-brain/projects.jsonl
U=0; P=0
[ -f "$USER_FILE" ] && U=$(wc -c < "$USER_FILE" | tr -d ' ')
[ -f "$PROJECT_FILE" ] && P=$(wc -c < "$PROJECT_FILE" | tr -d ' ')
echo "USER.md: ${U} bytes"
echo "PROJECT.md ($SLUG): ${P} bytes"
echo "Combined: $((U + P)) bytes (cap ≈ 3200)"
If the combined size exceeds ~3200 bytes, flag it — the hot tier is meant to stay small and always-loaded.
projects.jsonl is JSONL; one record per registered project (see setup skill for the schema).
COUNT=0
[ -f "$INDEX_FILE" ] && COUNT=$(grep -c '"slug"' "$INDEX_FILE" 2>/dev/null || true)
echo "Registered projects: ${COUNT}"
If the active $SLUG is not in projects.jsonl, surface that — the user probably should run /second-brain:setup.
Prefer the knowledge_stats MCP tool when available — it reads the wiki tree directly and returns a formatted breakdown:
knowledge_stats()
If the MCP tool is unavailable, fall back to a direct filesystem scan. Resolve the knowledge dir from the env var Claude Code injects per userConfig (skill-body ${user_config.X} placeholders DO NOT expand in bash):
KD="${CLAUDE_PLUGIN_OPTION_KNOWLEDGE_DIR:-$HOME/knowledge}"
for dir in "$KD"/wiki/*/; do
[ -d "$dir" ] || continue
name=$(basename "$dir")
N=$(find "$dir" -name '*.md' -type f ! -name 'index.md' 2>/dev/null | wc -l | tr -d ' ')
echo " ${name}: ${N}"
done
# Also check for index.md
if [ -f "$KD/wiki/index.md" ]; then
echo " index.md: present"
else
echo " index.md: MISSING (run knowledge_reindex)"
fi
Run knowledge_validate MCP tool if available to detect issues:
knowledge_validate()
If unavailable, skip — validation also runs automatically during knowledge_reindex and on session start via ensure-dirs.sh.
Report accumulated persona signals and any ready for graduation:
PSFILE=~/.second-brain/persona-signals.jsonl
if [ -f "$PSFILE" ] && [ -s "$PSFILE" ]; then
TOTAL=$(wc -l < "$PSFILE" | tr -d ' ')
READY=$(jq -c 'select(.count >= 3 and .graduated == false)' "$PSFILE" 2>/dev/null | wc -l | tr -d ' ')
GRADUATED=$(jq -c 'select(.graduated == true)' "$PSFILE" 2>/dev/null | wc -l | tr -d ' ')
echo "Persona signals: ${TOTAL} tracked, ${READY} ready to graduate, ${GRADUATED} graduated"
else
echo "Persona signals: none yet"
fi
If signals are ready to graduate (count ≥ 3, not yet graduated), nudge the user to run /second-brain:improve.
If the Stop-hook predicate fired in a recent session, a flag file is left for the next session to act on. Surface it so the user knows there is queued reflection work.
FLAG=~/.second-brain/.project-update-pending-"$SLUG"
if [ -f "$FLAG" ]; then
echo "Pending PROJECT.md update flagged for $SLUG (run /second-brain:improve to apply)."
fi
Run verify.sh to surface live-state issues that the static validator can't see (missing files, oversized hot tier, stale errors). Print its output verbatim — verify owns its own format.
bash "${CLAUDE_PLUGIN_ROOT}/scripts/verify.sh"
The script exits 0 with verify: ok when everything is healthy, or exits non-zero with one verify: FAIL: line per failed check. Do not auto-remediate — point the user at the relevant skill (/second-brain:setup for missing files, /second-brain:improve for oversized hot tier) and let them act.
Format as a clean block. Example:
# Second-brain status
## Active project
- slug: claude-code-plugin
## Hot tier
- USER.md: 420 bytes
- PROJECT.md: 1180 bytes
- Combined: 1600 bytes (cap ~3200)
- Registered projects: 3
## Cold tier (wiki pages)
- concepts: 12
- issues: 4
- entities: 7
- learnings: 9
- decisions: 5
## Persona
- Signals: 5 tracked, 1 ready to graduate, 2 graduated
## Pending
- (none)
Keep the output terse. No reflection-pipeline metrics — learnings.md, friction-log.jsonl, quality-rules.md, persona.md, and tool-registry.json no longer exist. error-log.jsonl is not dumped here, but verify.sh (Step 6) flags new entries since the last successful verify. If the user wants deep reflection on the current session, point them at /second-brain:improve.