Skip to content

m3taz-ahmed/aizee / skills/bmad-toolsmith

bmad-toolsmith

Verified

Smithy the Toolsmith builds and maintains BMad skills, agents and modules. Use when the user asks for Smithy or says "build a skill", "make an agent", "scaffold a skill", "turn my session logs into a skill", "fix this skill", "convert this prompt to a skill", "review this skill", "optimize this skill", "cut this skill down", "make this skill BMad compliant", "package a module", "validate my module" or "migrate my old module". Not for running evals (`bmad-eval`) or overriding an installed skill (`bmad-customize`).

FileKindSize
SKILL.mdskill md3.6 KB
approaches/eval-first.mdmarkdown1.3 KB
approaches/eval-loop.mdmarkdown2.4 KB
approaches/from-logs.mdmarkdown1.7 KB
approaches/lean.mdmarkdown1.7 KB
approaches/scaffold.mdmarkdown1.3 KB
approaches/skill-creator-loop.mdmarkdown1.2 KB
bmod.tomlconfig118 B
canon.mdmarkdown10.5 KB
customize.tomlconfig4.8 KB
discover.mdmarkdown5.5 KB
evals/triggers.jsonconfig3.3 KB
lenses/lens-architecture.mdmarkdown2.9 KB
lenses/lens-contract.mdmarkdown1.4 KB
lenses/lens-customization.mdmarkdown2.4 KB
lenses/lens-determinism.mdmarkdown1.8 KB
lenses/lens-leanness.mdmarkdown3.1 KB
lenses/lens-trigger.mdmarkdown2.4 KB
lenses/standards.mdmarkdown5.2 KB
modes/convert.mdmarkdown2.1 KB
modes/cut-roles.mdmarkdown3.3 KB
modes/cut.mdmarkdown3.3 KB
modes/edit.mdmarkdown1.3 KB
modes/migrate.mdmarkdown3.3 KB
modes/package.mdmarkdown2.6 KB
modes/review.mdmarkdown1.3 KB
modes/validate.mdmarkdown1.8 KB
scripts/count_tokens.pyscript3.6 KB
scripts/cut_check.pyscript5.1 KB
scripts/init_skill.pyscript13.3 KB
scripts/prepass.pyscript7.5 KB
scripts/process_template.pyscript4.8 KB
scripts/read_session_log.pyscript9.8 KB
scripts/registry.pyscript5.9 KB
scripts/scan_legacy_module.pyscript7.7 KB
scripts/scan_paths.pyscript9.2 KB
scripts/scan_scripts.pyscript6.6 KB
scripts/tests/test_count_tokens.pyscript4.1 KB
scripts/tests/test_cut_check.pyscript3.1 KB
scripts/tests/test_init_skill.pyscript9.7 KB
scripts/tests/test_memory_agent_scripts.pyscript8.6 KB
scripts/tests/test_prepass.pyscript8.3 KB
scripts/tests/test_process_template.pyscript4.7 KB
scripts/tests/test_read_session_log.pyscript7.3 KB
scripts/tests/test_registry.pyscript6.0 KB
scripts/tests/test_scan_legacy_module.pyscript8.2 KB
scripts/tests/test_scan_paths.pyscript7.7 KB
scripts/tests/test_scan_scripts.pyscript4.1 KB
shapes/agent/assets/SKILL-template.mdmarkdown2.0 KB
shapes/agent/assets/capability-template.mdmarkdown582 B
shapes/agent/assets/customize-template.tomlconfig1.9 KB
shapes/agent/assets/sample-capability.mdmarkdown887 B
shapes/agent/shape.mdmarkdown3.2 KB
shapes/memory-agent/assets/BOND-template.mdmarkdown392 B
shapes/memory-agent/assets/CAPABILITIES-template.mdmarkdown1017 B
shapes/memory-agent/assets/CREED-template.mdmarkdown2.1 KB
shapes/memory-agent/assets/HOW-I-REMEMBER-template.mdmarkdown3.3 KB
shapes/memory-agent/assets/PERSONA-template.mdmarkdown705 B
shapes/memory-agent/assets/PULSE-template.mdmarkdown849 B
shapes/memory-agent/assets/SKILL-template-bootloader.mdmarkdown4.2 KB
shapes/memory-agent/assets/customize-template.tomlconfig1.2 KB
shapes/memory-agent/assets/first-breath-config-template.mdmarkdown4.5 KB
shapes/memory-agent/assets/first-breath-template.mdmarkdown9.3 KB
shapes/memory-agent/assets/init-sanctum-template.pyscript5.7 KB
shapes/memory-agent/assets/intake-capability-template.mdmarkdown975 B
shapes/memory-agent/assets/wake-template.pyscript6.8 KB
shapes/memory-agent/shape.mdmarkdown5.0 KB
shapes/multi-skill-module/assets/help-template.mdmarkdown623 B
shapes/multi-skill-module/assets/member-bmod-template.tomlconfig490 B
shapes/multi-skill-module/assets/record-SKILL-template.mdmarkdown374 B
shapes/multi-skill-module/assets/record-bmod-template.tomlconfig802 B
shapes/multi-skill-module/assets/retired-template.tomlconfig287 B
shapes/multi-skill-module/assets/roster-template.tomlconfig567 B
shapes/multi-skill-module/shape.mdmarkdown4.3 KB
shapes/plain-skill/assets/SKILL-template.mdmarkdown2.0 KB
shapes/plain-skill/assets/customize-template.tomlconfig1.0 KB
shapes/plain-skill/shape.mdmarkdown2.9 KB
shapes/rendered-agent/assets/SKILL-template.mdmarkdown1.0 KB
shapes/rendered-agent/assets/capability.mdmarkdown1.1 KB
shapes/rendered-agent/assets/customize-template.tomlconfig2.6 KB
shapes/rendered-agent/assets/workflow.mdmarkdown1.8 KB
shapes/rendered-agent/shape.mdmarkdown3.8 KB
shapes/rendered-skill/assets/SKILL-template.mdmarkdown1.0 KB
shapes/rendered-skill/assets/customize-template.tomlconfig990 B
shapes/rendered-skill/assets/step.mdmarkdown688 B
shapes/rendered-skill/assets/workflow.mdmarkdown1004 B
shapes/rendered-skill/shape.mdmarkdown2.2 KB
shapes/script-utility/assets/SKILL-template.mdmarkdown859 B
shapes/script-utility/assets/script-template.pyscript1.5 KB
shapes/script-utility/assets/test-template.pyscript1.2 KB
shapes/script-utility/shape.mdmarkdown1.6 KB
shapes/single-skill-module/assets/bmod-template.tomlconfig696 B
shapes/single-skill-module/assets/help-template.mdmarkdown177 B
shapes/single-skill-module/shape.mdmarkdown2.5 KB
ship.mdmarkdown6.4 KB

shapes/memory-agent/assets/wake-template.py

View on GitHub
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.11"
# ///
"""Waking: load the agent's self in one pass, or route to First Breath.

Run on activation. Determines the mode from the filesystem (and the --pulse
flag) and, when the sanctum is complete, prints the identity files in a single
read (PERSONA, CREED, BOND, HOW-I-REMEMBER, CAPABILITIES) followed by a map of the
memory: each folder under memory/ and raw/ with its file count, the newest
dated files, how many raw files are still undistilled, when the memory was last
tended (memory/.tended) with the session notes written since, and
memory/pending.md when it has content. The memory files themselves are not printed; the agent
reads the ones a conversation reaches. In --pulse mode it also appends
PULSE.md. It says when the name in PERSONA.md has gone from the SKILL.md
description. When the sanctum is missing or incomplete, it prints a directive to
run First Breath, whose script finishes an incomplete sanctum.

This loads runtime memory only. It never reads or writes config or customize.toml.

Usage:
    uv run {skill-root}/scripts/wake.py <project-root> [--pulse]

    project-root: the folder holding _bmad/
"""

import re
import sys
from pathlib import Path

# The skill folder's name is the skill name; this script lives in its scripts/.
SKILL_NAME = Path(__file__).resolve().parent.parent.name

# Load order: the "become yourself" set. All must exist for the sanctum to count as born.
IDENTITY_FILES = [
    "PERSONA.md",
    "CREED.md",
    "BOND.md",
    "HOW-I-REMEMBER.md",
    "CAPABILITIES.md",
]

RECENT_COUNT = 8
DATED_RE = re.compile(r"^(\d{4}-\d{2}-\d{2})")
STATUS_RAW_RE = re.compile(r"^status:\s*raw\s*$", re.MULTILINE)
PERSONA_NAME_RE = re.compile(r"^- \*\*Name:\*\* ([^{*\s][^{*\n]*)$", re.MULTILINE)


def emit(path: Path) -> None:
    print(f"\n===== {path.name} =====")
    print(path.read_text(encoding="utf-8").rstrip())


def folder_lines(root: Path, label: str) -> list[str]:
    """One line per folder under root (root itself when it has files), with its file count."""
    if not root.is_dir():
        return []
    lines = []
    direct = [p for p in root.iterdir() if p.is_file() and not p.name.startswith(".")]
    if direct:
        lines.append(f"{label}/ ({len(direct)} files)")
    for folder in sorted(p for p in root.rglob("*") if p.is_dir()):
        count = sum(1 for p in folder.iterdir() if p.is_file() and not p.name.startswith("."))
        rel = folder.relative_to(root.parent).as_posix()
        lines.append(f"{rel}/ ({count} files)")
    return lines


def recent_dated(root: Path) -> list[str]:
    """The newest dated files under root, by the date in their names."""
    if not root.is_dir():
        return []
    dated = [p for p in root.rglob("*") if p.is_file() and DATED_RE.match(p.name)]
    dated.sort(key=lambda p: (DATED_RE.match(p.name).group(1), p.name), reverse=True)
    return [p.relative_to(root.parent).as_posix() for p in dated[:RECENT_COUNT]]


def undistilled(raw: Path) -> list[str]:
    if not raw.is_dir():
        return []
    out = []
    for p in sorted(raw.iterdir()):
        if not p.is_file():
            continue
        try:
            head = p.read_text(encoding="utf-8", errors="replace")[:2000]
        except OSError:
            continue
        if STATUS_RAW_RE.search(head):
            out.append(p.name)
    return out


def tending_line(sanctum: Path) -> str:
    """When memory was last tended and how many session notes came after it."""
    stamp = sanctum / "memory" / ".tended"
    tended = stamp.read_text(encoding="utf-8").strip()[:10] if stamp.is_file() else ""
    sessions = sanctum / "memory" / "sessions"
    notes = [p.name for p in sessions.iterdir() if p.is_file() and DATED_RE.match(p.name)] if sessions.is_dir() else []
    since = [n for n in notes if DATED_RE.match(n).group(1) > tended] if tended else notes
    if tended:
        return f"Tended: {tended}; session notes since: {len(since)}"
    return f"Never tended; session notes: {len(since)}"


def emit_map(sanctum: Path) -> None:
    print("\n===== memory map =====")
    lines = folder_lines(sanctum / "memory", "memory") + folder_lines(sanctum / "raw", "raw")
    print("\n".join(lines) if lines else "(empty: nothing remembered yet)")
    recent = recent_dated(sanctum / "memory")
    if recent:
        print("\nNewest:")
        print("\n".join(f"  {r}" for r in recent))
    print(f"\n{tending_line(sanctum)}")
    raw = undistilled(sanctum / "raw")
    if raw:
        print(f"\nUndistilled raw ({len(raw)}):")
        print("\n".join(f"  raw/{r}" for r in raw))
    pending = sanctum / "memory" / "pending.md"
    if pending.is_file() and pending.read_text(encoding="utf-8").strip():
        emit(pending)


def emit_lost_name(sanctum: Path, project_root: Path) -> None:
    """Skills updates replace SKILL.md, which drops the name First Breath wrote into its description."""
    skill_md = Path(__file__).resolve().parent.parent / "SKILL.md"
    # A global install serves every project, so one project's name does not belong in it.
    if not skill_md.is_file() or not skill_md.is_relative_to(project_root):
        return
    named = PERSONA_NAME_RE.search((sanctum / "PERSONA.md").read_text(encoding="utf-8"))
    if not named:
        return
    called = named[1].strip()
    lines = skill_md.read_text(encoding="utf-8").splitlines()
    if not any(line.startswith("description:") and called in line for line in lines):
        print("\n===== description =====")
        print(
            f"Your name, {called}, is missing from the description in {skill_md}. Put it back so `Use when` opens "
            "with your owner asking to talk to you by that name, and change nothing else in that file."
        )


def main() -> int:
    args = sys.argv[1:]
    pulse = "--pulse" in args
    positional = [a for a in args if not a.startswith("--")]
    if not positional:
        print("Usage: wake.py <project-root> [--pulse]", file=sys.stderr)
        return 2

    project_root = Path(positional[0]).resolve()
    sanctum = project_root / "_bmad" / "memory" / SKILL_NAME

    missing = [name for name in IDENTITY_FILES if not (sanctum / name).is_file()]
    if missing:
        print("MODE: FIRST_BREATH")
        if sanctum.is_dir():
            print(f"INCOMPLETE SANCTUM at {sanctum}: missing {', '.join(missing)}")
        else:
            print(f"NO SANCTUM at {sanctum}")
        print("This is your one birth. Load references/first-breath.md and follow it.")
        return 0

    print("MODE: PULSE" if pulse else "MODE: WAKING")
    print(f"Sanctum: {sanctum}")
    for name in IDENTITY_FILES:
        emit(sanctum / name)
    if pulse and (sanctum / "PULSE.md").is_file():
        emit(sanctum / "PULSE.md")
    emit_map(sanctum)
    emit_lost_name(sanctum, project_root)
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall