Skip to content

try-works/role-model / .agents/skills/recursive-mode

recursive-mode

Unverified

Repository workflow orchestration skill for staged implementation, locked artifacts, late-phase receipts, and durable memory maintenance. Use when executing recursive-mode runs, resuming a run, locking a phase, or verifying locks.

FileKindSize
.agent/PLANS.mdmarkdown2.6 KB
.codex/AGENTS.mdmarkdown7.5 KB
.gitattributesother522 B
.gitignoreother553 B
.recursive/AGENTS.mdmarkdown3.3 KB
.recursive/DECISIONS.mdmarkdown1.1 KB
.recursive/README.mdmarkdown8.5 KB
.recursive/RECURSIVE.mdmarkdown107.5 KB
.recursive/STATE.mdmarkdown1.6 KB
.recursive/config/recursive-router.jsonconfig1.4 KB
.recursive/memory/MEMORY.mdmarkdown3.3 KB
.recursive/memory/archive/.gitkeepother1 B
.recursive/memory/domains/.gitkeepother1 B
.recursive/memory/episodes/.gitkeepother1 B
.recursive/memory/incidents/.gitkeepother1 B
.recursive/memory/patterns/.gitkeepother1 B
.recursive/memory/skills/SKILLS.mdmarkdown4.3 KB
.recursive/memory/skills/availability/.gitkeepother1 B
.recursive/memory/skills/issues/.gitkeepother1 B
.recursive/memory/skills/patterns/.gitkeepother1 B
.recursive/memory/skills/patterns/delegated-verification-and-refresh.mdmarkdown1.7 KB
.recursive/memory/skills/patterns/phase8-skill-memory-promotion.mdmarkdown1.4 KB
.recursive/memory/skills/usage/.gitkeepother1 B
.recursive/memory/skills/usage/skill-discovery-and-evaluation.mdmarkdown1.6 KB
.recursive/run/.gitkeepother1 B
AGENTS.mdmarkdown7.8 KB
LICENSEother11.1 KB
README.mdmarkdown17.8 KB
SKILL.mdskill md13.1 KB
agents/code-reviewer.mdmarkdown6.1 KB
agents/implementer.mdmarkdown6.3 KB
agents/openai.yamlconfig202 B
docs/templates/commands/check-reusable-repo-hygiene.mdmarkdown1.3 KB
docs/templates/commands/recursive-closeout.mdmarkdown2.8 KB
docs/templates/commands/recursive-init.mdmarkdown2.2 KB
docs/templates/commands/recursive-lock.mdmarkdown1.3 KB
docs/templates/commands/recursive-review-bundle.mdmarkdown3.6 KB
docs/templates/commands/recursive-status.mdmarkdown2.0 KB
docs/templates/commands/recursive-subagent-action.mdmarkdown4.2 KB
docs/templates/commands/test-recursive-mode-smoke.mdmarkdown3.4 KB
docs/templates/hooks/hooks.jsonconfig400 B
docs/templates/hooks/run-hook.cmdscript1.2 KB
docs/templates/hooks/session-start.ps1script3.6 KB
docs/templates/hooks/session-start.shscript3.5 KB
references/agents-block.mdmarkdown7.4 KB
references/artifact-template.mdmarkdown70.7 KB
references/benchmark-addon/recursive-benchmark/BENCHMARK-ADDON.mdmarkdown6.7 KB
references/benchmark-addon/recursive-benchmark/recursive-benchmark/BENCHMARK-ADDON.mdmarkdown6.7 KB
references/benchmark-addon/recursive-benchmark/recursive-benchmark/references/patterns.mdmarkdown4.9 KB
references/benchmark-addon/recursive-benchmark/references/patterns.mdmarkdown4.9 KB
references/benchmarks/README.mdmarkdown1.5 KB
references/benchmarks/local-first-planner/00-requirements.mdmarkdown3.3 KB
references/benchmarks/local-first-planner/README.mdmarkdown1.1 KB
references/benchmarks/local-first-planner/prompt-recursive-off.mdmarkdown1.1 KB
references/benchmarks/local-first-planner/prompt-recursive-on.mdmarkdown14.8 KB
references/benchmarks/local-first-planner/scoring-rubric.mdmarkdown1.3 KB
references/benchmarks/local-first-planner/starter/.gitignoreother30 B
references/benchmarks/local-first-planner/starter/README.mdmarkdown264 B
references/benchmarks/local-first-planner/starter/index.htmlother316 B
references/benchmarks/local-first-planner/starter/package.jsonmanifest628 B
references/benchmarks/local-first-planner/starter/src/App.test.tsxother334 B
references/benchmarks/local-first-planner/starter/src/App.tsxother971 B
references/benchmarks/local-first-planner/starter/src/main.tsxother238 B
references/benchmarks/local-first-planner/starter/src/styles.cssother976 B
references/benchmarks/local-first-planner/starter/src/test-setup.tsscript43 B
references/benchmarks/local-first-planner/starter/src/vite-env.d.tsscript38 B
references/benchmarks/local-first-planner/starter/tsconfig.app.jsonconfig552 B
references/benchmarks/local-first-planner/starter/tsconfig.jsonconfig89 B
references/benchmarks/local-first-planner/starter/vite.config.tsscript214 B
references/benchmarks/release-readiness-dashboard/00-requirements.mdmarkdown5.9 KB
references/benchmarks/release-readiness-dashboard/README.mdmarkdown1.2 KB
references/benchmarks/release-readiness-dashboard/prompt-recursive-off.mdmarkdown1.1 KB
references/benchmarks/release-readiness-dashboard/prompt-recursive-on.mdmarkdown14.8 KB
references/benchmarks/release-readiness-dashboard/scoring-rubric.mdmarkdown1.8 KB
references/benchmarks/release-readiness-dashboard/starter/.gitignoreother30 B
references/benchmarks/release-readiness-dashboard/starter/README.mdmarkdown272 B
references/benchmarks/release-readiness-dashboard/starter/index.htmlother324 B
references/benchmarks/release-readiness-dashboard/starter/package.jsonmanifest628 B
references/benchmarks/release-readiness-dashboard/starter/src/App.test.tsxother342 B
references/benchmarks/release-readiness-dashboard/starter/src/App.tsxother979 B
references/benchmarks/release-readiness-dashboard/starter/src/main.tsxother238 B
references/benchmarks/release-readiness-dashboard/starter/src/styles.cssother976 B
references/benchmarks/release-readiness-dashboard/starter/src/test-setup.tsscript43 B
references/benchmarks/release-readiness-dashboard/starter/src/vite-env.d.tsscript38 B
references/benchmarks/release-readiness-dashboard/starter/tsconfig.app.jsonconfig552 B
references/benchmarks/release-readiness-dashboard/starter/tsconfig.jsonconfig89 B
references/benchmarks/release-readiness-dashboard/starter/vite.config.tsscript214 B
references/benchmarks/scientific-calculator-rust/00-requirements.mdmarkdown4.1 KB
references/benchmarks/scientific-calculator-rust/README.mdmarkdown1.4 KB
references/benchmarks/scientific-calculator-rust/prompt-recursive-off.mdmarkdown1.1 KB
references/benchmarks/scientific-calculator-rust/prompt-recursive-on.mdmarkdown16.6 KB
references/benchmarks/scientific-calculator-rust/scoring-rubric.mdmarkdown1.5 KB
references/benchmarks/scientific-calculator-rust/starter/.gitignoreother14 B
references/benchmarks/scientific-calculator-rust/starter/Cargo.lockmanifest25.7 KB
references/benchmarks/scientific-calculator-rust/starter/Cargo.tomlmanifest226 B
references/benchmarks/team-capacity-board/00-requirements.mdmarkdown3.6 KB
references/benchmarks/team-capacity-board/README.mdmarkdown1.0 KB
references/benchmarks/team-capacity-board/prompt-recursive-off.mdmarkdown1.1 KB
references/benchmarks/team-capacity-board/prompt-recursive-on.mdmarkdown14.8 KB
references/benchmarks/team-capacity-board/scoring-rubric.mdmarkdown1.4 KB
references/benchmarks/team-capacity-board/starter/.gitignoreother30 B
references/benchmarks/team-capacity-board/starter/README.mdmarkdown264 B
references/benchmarks/team-capacity-board/starter/index.htmlother316 B
references/benchmarks/team-capacity-board/starter/package.jsonmanifest628 B
references/benchmarks/team-capacity-board/starter/src/App.test.tsxother334 B
references/benchmarks/team-capacity-board/starter/src/App.tsxother971 B
references/benchmarks/team-capacity-board/starter/src/main.tsxother238 B
references/benchmarks/team-capacity-board/starter/src/styles.cssother976 B
references/benchmarks/team-capacity-board/starter/src/test-setup.tsscript43 B
references/benchmarks/team-capacity-board/starter/src/vite-env.d.tsscript38 B
references/benchmarks/team-capacity-board/starter/tsconfig.app.jsonconfig552 B
references/benchmarks/team-capacity-board/starter/tsconfig.jsonconfig89 B
references/benchmarks/team-capacity-board/starter/vite.config.tsscript214 B
references/bootstrap/RECURSIVE.mdmarkdown109.9 KB
references/fixtures/tiny-tasks-smoke-recipe.mdmarkdown2.6 KB
references/local-first-web-app-checklist.mdmarkdown1.6 KB
references/plans-canonical.mdmarkdown10.8 KB
scripts/check-reusable-repo-hygiene.ps1script625 B
scripts/check-reusable-repo-hygiene.pyscript6.3 KB
scripts/install-recursive-mode.ps1script36.0 KB
scripts/install-recursive-mode.pyscript31.8 KB
scripts/install-recursive-mode.shscript363 B
scripts/lint-recursive-run.ps1script739 B
scripts/lint-recursive-run.pyscript127.4 KB
scripts/recursive-closeout.ps1script1015 B
scripts/recursive-closeout.pyscript24.0 KB
scripts/recursive-init.ps1script18.7 KB
scripts/recursive-init.pyscript12.6 KB
scripts/recursive-lock.ps1script677 B
scripts/recursive-lock.pyscript12.6 KB
scripts/recursive-review-bundle.ps1script2.9 KB
scripts/recursive-review-bundle.pyscript22.1 KB
scripts/recursive-router-cli-configure.ps1script86 B
scripts/recursive-router-cli-configure.pyscript230 B
scripts/recursive-router-cli-init.ps1script81 B
scripts/recursive-router-cli-init.pyscript225 B
scripts/recursive-router-cli-invoke.ps1script83 B
scripts/recursive-router-cli-invoke.pyscript227 B
scripts/recursive-router-cli-probe.ps1script82 B
scripts/recursive-router-cli-probe.pyscript226 B
scripts/recursive-router-cli-resolve.ps1script84 B
scripts/recursive-router-cli-resolve.pyscript228 B
scripts/recursive-router-cli-validate.ps1script85 B
scripts/recursive-router-cli-validate.pyscript229 B
scripts/recursive-router-configure.ps1script798 B
scripts/recursive-router-configure.pyscript2.8 KB
scripts/recursive-router-init.ps1script490 B
scripts/recursive-router-init.pyscript925 B
scripts/recursive-router-invoke.ps1script1.5 KB
scripts/recursive-router-invoke.pyscript4.4 KB
scripts/recursive-router-probe.ps1script735 B
scripts/recursive-router-probe.pyscript1.6 KB
scripts/recursive-router-resolve.ps1script803 B
scripts/recursive-router-resolve.pyscript1.6 KB
scripts/recursive-router-validate.ps1script494 B
scripts/recursive-router-validate.pyscript804 B
scripts/recursive-status.ps1script674 B
scripts/recursive-status.pyscript97.7 KB
scripts/recursive-subagent-action.ps1script5.8 KB
scripts/recursive-subagent-action.pyscript12.4 KB
scripts/recursive-training-extract.ps1script586 B
scripts/recursive-training-extract.pyscript1.0 KB
scripts/recursive-training-grpo.ps1script1.2 KB
scripts/recursive-training-grpo.pyscript47.2 KB
scripts/recursive-training-loader.ps1script2.3 KB
scripts/recursive-training-loader.pyscript20.1 KB
scripts/recursive-training-mcp.ps1script721 B
scripts/recursive-training-mcp.pyscript10.1 KB
scripts/recursive-training-phase8-trigger.ps1script1.4 KB
scripts/recursive-training-phase8-trigger.pyscript4.0 KB
scripts/recursive-training-sync.ps1script735 B
scripts/recursive-training-sync.pyscript6.9 KB
scripts/recursive_phase_rules.pyscript12.7 KB
scripts/recursive_router_cli_lib.pyscript77 B
scripts/recursive_router_lib.pyscript84.5 KB
scripts/run-recursive-benchmark.ps1script2.1 KB
scripts/run-recursive-benchmark.pyscript376.1 KB
scripts/test-recursive-mode-smoke.ps1script1.0 KB
scripts/test-recursive-mode-smoke.pyscript121.0 KB
scripts/test_install_recursive_mode.pyscript38.4 KB
scripts/test_lint_recursive_run.pyscript4.1 KB
scripts/test_recursive_phase_rules.pyscript21.4 KB
scripts/test_recursive_review_bundle.pyscript5.8 KB
scripts/test_recursive_router.pyscript53.3 KB
scripts/test_recursive_subagent_action.pyscript3.2 KB
scripts/test_recursive_training.pyscript12.0 KB
scripts/test_run_recursive_benchmark.pyscript160.0 KB
scripts/verify-locks.ps1script733 B
scripts/verify-locks.pyscript13.8 KB

scripts/test_install_recursive_mode.py

View on GitHub
#!/usr/bin/env python3
from __future__ import annotations

import importlib.util
import json
import os
import shutil
import subprocess
import sys
import tempfile
import unittest
from pathlib import Path


MODULE_PATH = Path(__file__).with_name("install-recursive-mode.py")
SPEC = importlib.util.spec_from_file_location("install_recursive_mode", MODULE_PATH)
if SPEC is None or SPEC.loader is None:
    raise RuntimeError(f"Unable to load install module from {MODULE_PATH}")
install = importlib.util.module_from_spec(SPEC)
sys.modules[SPEC.name] = install
SPEC.loader.exec_module(install)

ROUTER_LIB_PATH = Path(__file__).with_name("recursive_router_lib.py")
ROUTER_SPEC = importlib.util.spec_from_file_location("recursive_router_lib", ROUTER_LIB_PATH)
if ROUTER_SPEC is None or ROUTER_SPEC.loader is None:
    raise RuntimeError(f"Unable to load router module from {ROUTER_LIB_PATH}")
router_lib = importlib.util.module_from_spec(ROUTER_SPEC)
sys.modules[ROUTER_SPEC.name] = router_lib
ROUTER_SPEC.loader.exec_module(router_lib)


class InstallRecursiveModeTests(unittest.TestCase):
    def test_package_surface_includes_recursive_training(self) -> None:
        repo_root = Path(__file__).resolve().parent.parent
        installable_skills = {path.parent.name for path in (repo_root / "skills").glob("*/SKILL.md")}

        self.assertEqual(
            {
                "recursive-debugging",
                "recursive-review-bundle",
                "recursive-router",
                "recursive-spec",
                "recursive-subagent",
                "recursive-tdd",
                "recursive-training",
                "recursive-worktree",
            },
            installable_skills,
        )
        root_skill = (repo_root / "SKILL.md").read_text(encoding="utf-8")
        self.assertIn("skills/recursive-training/SKILL.md", root_skill)

    def test_bootstrap_workflow_copy_matches_canonical(self) -> None:
        repo_root = Path(__file__).resolve().parent.parent
        start = "<!-- RECURSIVE-MODE-CANONICAL:START -->"
        end = "<!-- RECURSIVE-MODE-CANONICAL:END -->"
        canonical_raw = (repo_root / ".recursive" / "RECURSIVE.md").read_text(encoding="utf-8")
        bootstrap_raw = (repo_root / "references" / "bootstrap" / "RECURSIVE.md").read_text(encoding="utf-8")

        canonical = install.normalize_plain_or_wrapped_content(canonical_raw, start, end)
        bootstrap = install.normalize_plain_or_wrapped_content(bootstrap_raw, start, end)

        self.assertEqual(canonical, bootstrap)

    def test_resolve_canonical_workflow_path_prefers_repo_recursive_doc(self) -> None:
        with tempfile.TemporaryDirectory(prefix="install-recursive-mode-workflow-") as temp_dir:
            skill_root = Path(temp_dir)
            bootstrap_path = skill_root / "references" / "bootstrap" / "RECURSIVE.md"
            repo_recursive_path = skill_root / ".recursive" / "RECURSIVE.md"
            bootstrap_path.parent.mkdir(parents=True, exist_ok=True)
            repo_recursive_path.parent.mkdir(parents=True, exist_ok=True)
            bootstrap_path.write_text("bootstrap", encoding="utf-8")
            repo_recursive_path.write_text("repo-recursive", encoding="utf-8")

            resolved = install.resolve_canonical_workflow_path(skill_root)

            self.assertEqual(repo_recursive_path, resolved)

    def test_powershell_installer_prefers_repo_recursive_doc(self) -> None:
        ps1_script = MODULE_PATH.with_suffix(".ps1").read_text(encoding="utf-8")
        repo_index = ps1_script.index('(Join-Path (Join-Path $SkillRoot ".recursive") "RECURSIVE.md")')
        bootstrap_index = ps1_script.index(
            '(Join-Path (Join-Path $SkillRoot "references") "bootstrap\\RECURSIVE.md")'
        )

        self.assertLess(repo_index, bootstrap_index)

    def test_normalize_plain_or_wrapped_content_prefers_plain_prefix(self) -> None:
        start = "<!-- START -->"
        end = "<!-- END -->"
        plain = "alpha\nbeta"
        malformed = f"{plain}\n\n{start}\nwrapped body\n{end}\n"

        self.assertEqual(plain, install.normalize_plain_or_wrapped_content(malformed, start, end))

    def test_recursive_agents_router_treats_benchmark_as_opt_in(self) -> None:
        body = install.recursive_agents_router_body()

        self.assertIn("separate optional `recursive-benchmark` add-on", body)
        self.assertIn("<recursive-benchmark-package-or-repo>", body)
        self.assertNotIn("/skills/recursive-benchmark/SKILL.md", body)
        self.assertNotIn("/references/benchmarks/local-first-planner/README.md", body)
        self.assertNotIn("/scripts/run-recursive-benchmark.py", body)

    def test_recursive_agents_router_avoids_missing_source_repo_paths(self) -> None:
        body = install.recursive_agents_router_body()

        self.assertIn("the installed `recursive-spec` skill", body)
        self.assertIn("the installed `recursive-training` skill", body)
        for forbidden in (
            "`/.recursive/README.md`",
            "`/skills/recursive-spec/SKILL.md`",
            "`/scripts/install-recursive-mode.py`",
            "`/references/artifact-template.md`",
            "`/skills/recursive-router/SKILL.md`",
            "`/skills/recursive-training/SKILL.md`",
        ):
            with self.subTest(forbidden=forbidden):
                self.assertNotIn(forbidden, body)

    def test_plans_bridge_treats_benchmark_as_opt_in(self) -> None:
        body = install.plans_bridge_body()

        self.assertIn("separate optional `recursive-benchmark` add-on", body)
        self.assertIn("<recursive-benchmark-package-or-repo>", body)
        self.assertNotIn("should use the packaged benchmark fixture", body)
        self.assertEqual(1, body.count("If the user asks to route delegated work through another transport/model"))

    def test_gitattributes_excludes_benchmark_add_on_from_default_exports(self) -> None:
        gitattributes = Path(__file__).resolve().parent.parent / ".gitattributes"
        content = gitattributes.read_text(encoding="utf-8")

        self.assertIn("references/benchmark-addon export-ignore", content)
        self.assertIn("references/benchmarks export-ignore", content)
        self.assertIn("scripts/run-recursive-benchmark.py export-ignore", content)

    def test_benchmark_add_on_is_not_a_default_skill_entrypoint(self) -> None:
        repo_root = Path(__file__).resolve().parent.parent
        self.assertFalse((repo_root / "skills" / "recursive-benchmark" / "SKILL.md").exists())
        self.assertFalse((repo_root / "skills" / "recursive-benchmark" / "recursive-benchmark" / "SKILL.md").exists())
        self.assertTrue(
            (repo_root / "references" / "benchmark-addon" / "recursive-benchmark" / "BENCHMARK-ADDON.md").exists()
        )
        self.assertTrue(
            (
                repo_root
                / "references"
                / "benchmark-addon"
                / "recursive-benchmark"
                / "recursive-benchmark"
                / "BENCHMARK-ADDON.md"
            ).exists()
        )

    def test_current_workflow_docs_default_to_v2(self) -> None:
        repo_root = Path(__file__).resolve().parent.parent
        expectations = {
            Path(".recursive/STATE.md"): (
                "The workflow profile in active use is `recursive-mode-audit-v2`.",
            ),
            Path(".recursive/RECURSIVE.md"): (
                "New runs should also include `Workflow version: recursive-mode-audit-v2`.",
                "add `Workflow version: recursive-mode-audit-v2` to `00-requirements.md`",
            ),
            Path("references/bootstrap/RECURSIVE.md"): (
                "New runs should also include `Workflow version: recursive-mode-audit-v2`.",
                "add `Workflow version: recursive-mode-audit-v2` to `00-requirements.md`",
            ),
            Path("docs/templates/commands/recursive-init.md"): (
                "Marks the run as `recursive-mode-audit-v2`",
            ),
            Path("docs/templates/commands/recursive-status.md"): (
                "Workflow Profile: recursive-mode-audit-v2",
            ),
            Path("references/artifact-template.md"): (
                "Use this block in every audited phase for `recursive-mode-audit-v1` and `recursive-mode-audit-v2`:",
                "Workflow version: `recursive-mode-audit-v2`",
            ),
            Path("references/fixtures/tiny-tasks-smoke-recipe.md"): (
                "- Workflow profile: `recursive-mode-audit-v2`",
            ),
        }

        for relative_path, required_snippets in expectations.items():
            content = (repo_root / relative_path).read_text(encoding="utf-8")
            for snippet in required_snippets:
                with self.subTest(path=str(relative_path), snippet=snippet):
                    self.assertIn(snippet, content)

    def test_root_docs_list_recursive_router_and_config_surface(self) -> None:
        repo_root = Path(__file__).resolve().parent.parent
        readme = (repo_root / "README.md").read_text(encoding="utf-8")
        skill = (repo_root / "SKILL.md").read_text(encoding="utf-8")

        self.assertIn("recursive-router", readme)
        self.assertIn("/.recursive/config/recursive-router.json", readme)
        self.assertIn("recursive-router", skill)
        self.assertIn("/.recursive/config/recursive-router.json", skill)
        self.assertIn("recursive-training", readme)

    def test_helper_inventories_include_closeout_and_training_extract(self) -> None:
        repo_root = Path(__file__).resolve().parent.parent
        skill = (repo_root / "SKILL.md").read_text(encoding="utf-8")
        self.assertIn("scripts/recursive-closeout.py", skill)
        self.assertIn("scripts/recursive-closeout.ps1", skill)
        self.assertIn(".recursive/scripts/recursive-training-extract.py", skill)
        self.assertIn(".recursive/scripts/recursive-training-extract.ps1", skill)

        for relative_path in (Path("AGENTS.md"), Path(".codex/AGENTS.md"), Path("references/agents-block.md")):
            content = (repo_root / relative_path).read_text(encoding="utf-8")
            with self.subTest(path=str(relative_path), snippet="recursive-closeout"):
                self.assertIn("`recursive-closeout`", content)
            with self.subTest(path=str(relative_path), snippet="recursive-training-extract"):
                self.assertIn("`recursive-training-extract`", content)

    def test_readmes_publish_canonical_regression_command_and_closeout_helper(self) -> None:
        repo_root = Path(__file__).resolve().parent.parent
        regression_command = (
            "python -m unittest scripts.test_install_recursive_mode scripts.test_lint_recursive_run "
            "scripts.test_recursive_phase_rules scripts.test_recursive_review_bundle "
            "scripts.test_recursive_router scripts.test_recursive_subagent_action "
            "scripts.test_recursive_training scripts.test_run_recursive_benchmark"
        )

        root_readme = (repo_root / "README.md").read_text(encoding="utf-8")
        self.assertIn(regression_command, root_readme)
        self.assertIn("python scripts/test-recursive-mode-smoke.py", root_readme)

        maintainer_readme = (repo_root / ".recursive" / "README.md").read_text(encoding="utf-8")
        self.assertIn(regression_command, maintainer_readme)
        self.assertIn('python "<SKILL_DIR>/scripts/recursive-closeout.py" --repo-root . --run-id "<run-id>" --phase 04', maintainer_readme)
        self.assertIn('pwsh -NoProfile -File "<SKILL_DIR>/scripts/recursive-closeout.ps1" -RepoRoot . -RunId "<run-id>" -Phase 04', maintainer_readme)

    def test_root_readme_workflow_overview_uses_phase_zero_worktree_gate(self) -> None:
        repo_root = Path(__file__).resolve().parent.parent
        readme = (repo_root / "README.md").read_text(encoding="utf-8")

        self.assertIn("Phase 0: requirements and worktree setup", readme)
        self.assertIn("Phase 1-2: AS-IS and plan", readme)
        self.assertNotIn("Phase 0-2: requirements, AS-IS, plan", readme)

    def test_templates_include_routing_metadata_for_routed_delegation(self) -> None:
        repo_root = Path(__file__).resolve().parent.parent
        expectations = {
            Path("docs/templates/commands/recursive-review-bundle.md"): (
                "Routing Config Path",
                "Routing Discovery Path",
                "Routed CLI",
                "Routed Model",
            ),
            Path("docs/templates/commands/recursive-subagent-action.md"): (
                "Routing Config Path",
                "Routing Discovery Path",
                "Routed CLI",
                "Routed Model",
            ),
            Path("references/artifact-template.md"): (
                "Routing Config Path",
                "Routing Discovery Path",
                "Routed CLI",
                "Routed Model",
            ),
        }

        for relative_path, required_snippets in expectations.items():
            content = (repo_root / relative_path).read_text(encoding="utf-8")
            for snippet in required_snippets:
                with self.subTest(path=str(relative_path), snippet=snippet):
                    self.assertIn(snippet, content)

    def test_subskill_docs_use_repo_root_script_examples(self) -> None:
        repo_root = Path(__file__).resolve().parent.parent
        expectations = {
            Path("skills/recursive-router/SKILL.md"): (
                "./scripts/recursive-router-init.py",
                "./scripts/recursive-router-invoke.py",
                "./.recursive/run/<run-id>/router-prompts/code-reviewer-bundle.md",
            ),
            Path("skills/recursive-review-bundle/SKILL.md"): (
                "./scripts/recursive-review-bundle.py",
                "./scripts/recursive-review-bundle.ps1",
            ),
        }
        forbidden = {
            Path("skills/recursive-router/SKILL.md"): (
                "<SKILL_DIR>/scripts/recursive-router-",
                "/" "tmp" "/code-reviewer-bundle.md",
            ),
            Path("skills/recursive-review-bundle/SKILL.md"): ("../../scripts/recursive-review-bundle",),
        }

        for relative_path, required_snippets in expectations.items():
            content = (repo_root / relative_path).read_text(encoding="utf-8")
            for snippet in required_snippets:
                with self.subTest(path=str(relative_path), snippet=snippet):
                    self.assertIn(snippet, content)
            for snippet in forbidden[relative_path]:
                with self.subTest(path=str(relative_path), forbidden=snippet):
                    self.assertNotIn(snippet, content)

    def test_mirrored_benchmark_add_on_source_doc_matches_primary_copy(self) -> None:
        repo_root = Path(__file__).resolve().parent.parent
        primary = (
            repo_root / "references" / "benchmark-addon" / "recursive-benchmark" / "BENCHMARK-ADDON.md"
        ).read_text(encoding="utf-8")
        mirror = (
            repo_root
            / "references"
            / "benchmark-addon"
            / "recursive-benchmark"
            / "recursive-benchmark"
            / "BENCHMARK-ADDON.md"
        ).read_text(encoding="utf-8")

        self.assertEqual(primary, mirror)

    def test_agents_block_uses_helper_names_not_missing_root_script_paths(self) -> None:
        repo_root = Path(__file__).resolve().parent.parent
        content = (repo_root / "references" / "agents-block.md").read_text(encoding="utf-8")

        self.assertIn("Invoke these helper names", content)
        self.assertIn("`install-recursive-mode`", content)
        self.assertIn("`recursive-closeout`", content)
        self.assertIn("`recursive-training-extract`", content)
        self.assertNotIn("`scripts/install-recursive-mode.py`", content)
        self.assertNotIn("`scripts/recursive-status.py`", content)

    def test_training_and_router_skill_manifests_exist(self) -> None:
        repo_root = Path(__file__).resolve().parent.parent
        self.assertTrue((repo_root / "skills" / "recursive-training" / "agents" / "openai.yaml").exists())
        self.assertTrue((repo_root / "skills" / "recursive-router" / "agents" / "openai.yaml").exists())

    def test_recursive_training_skill_is_split_into_reference_docs(self) -> None:
        repo_root = Path(__file__).resolve().parent.parent
        skill_path = repo_root / "skills" / "recursive-training" / "SKILL.md"
        line_count = len(skill_path.read_text(encoding="utf-8").splitlines())

        self.assertLess(line_count, 500)
        self.assertTrue((repo_root / "skills" / "recursive-training" / "references" / "memory-architecture.md").exists())
        self.assertTrue((repo_root / "skills" / "recursive-training" / "references" / "phase8-and-loading.md").exists())

    def test_subagent_skill_references_repo_root_paths(self) -> None:
        repo_root = Path(__file__).resolve().parent.parent
        content = (repo_root / "skills" / "recursive-subagent" / "SKILL.md").read_text(encoding="utf-8")

        self.assertIn("/references/artifact-template.md", content)
        self.assertIn("/skills/recursive-subagent/agents/code-reviewer.md", content)
        self.assertIn("/skills/recursive-subagent/agents/implementer.md", content)
        self.assertNotIn("`references/artifact-template.md`", content)
        self.assertNotIn("`agents/code-reviewer.md`", content)
        self.assertNotIn("`agents/implementer.md`", content)

    def test_phase_oriented_skills_reflect_current_artifact_contract(self) -> None:
        repo_root = Path(__file__).resolve().parent.parent
        expectations = {
            Path("skills/recursive-spec/SKILL.md"): ("## TODO", "Workflow version: `recursive-mode-audit-v2`"),
            Path("skills/recursive-worktree/SKILL.md"): ("## TODO", "Normalized diff command"),
            Path("skills/recursive-debugging/SKILL.md"): (
                "Subagent Capability Probe",
                "Delegation Decision Basis",
                "## Requirement Completion Status",
            ),
            Path("skills/recursive-tdd/SKILL.md"): (
                "## TODO",
                "Subagent Capability Probe",
                "Delegation Decision Basis",
                "## Requirement Completion Status",
            ),
        }

        for relative_path, required_snippets in expectations.items():
            content = (repo_root / relative_path).read_text(encoding="utf-8")
            for snippet in required_snippets:
                with self.subTest(path=str(relative_path), snippet=snippet):
                    self.assertIn(snippet, content)

        debugging = (repo_root / "skills" / "recursive-debugging" / "SKILL.md").read_text(encoding="utf-8")
        self.assertNotIn("Return to Phase 2", debugging)

    def test_installer_gitignores_device_local_router_discovery_inventory(self) -> None:
        with tempfile.TemporaryDirectory(prefix="install-recursive-mode-") as temp_dir:
            repo_root = Path(temp_dir) / "repo"
            completed = subprocess.run(
                [sys.executable, str(MODULE_PATH), "--repo-root", str(repo_root)],
                text=True,
                capture_output=True,
                check=False,
            )

            self.assertEqual(
                completed.returncode,
                0,
                f"installer failed\nSTDOUT:\n{completed.stdout}\nSTDERR:\n{completed.stderr}",
            )
            self.assertTrue((repo_root / ".recursive" / "config" / "recursive-router.json").exists())
            self.assertFalse((repo_root / ".recursive" / "config" / "recursive-router-discovered.json").exists())
            gitignore = (repo_root / ".gitignore").read_text(encoding="utf-8")
            self.assertIn("/.recursive/config/recursive-router-discovered.json", gitignore)

    def test_installer_bootstraps_training_memory_and_scripts(self) -> None:
        with tempfile.TemporaryDirectory(prefix="install-recursive-mode-training-") as temp_dir:
            repo_root = Path(temp_dir) / "repo"
            completed = subprocess.run(
                [sys.executable, str(MODULE_PATH), "--repo-root", str(repo_root)],
                text=True,
                capture_output=True,
                check=False,
            )

            self.assertEqual(
                completed.returncode,
                0,
                f"installer failed\nSTDOUT:\n{completed.stdout}\nSTDERR:\n{completed.stderr}",
            )
            self.assertTrue((repo_root / ".recursive" / "memory" / "training" / ".gitkeep").exists())
            self.assertTrue((repo_root / ".recursive" / "scripts" / "recursive-training-loader.py").exists())
            self.assertTrue((repo_root / ".recursive" / "scripts" / "recursive-training-sync.py").exists())
            self.assertTrue((repo_root / ".recursive" / "scripts" / "recursive-training-extract.py").exists())
            self.assertIn(
                "RECURSIVE-MODE-MEMORY-POINTERS:START",
                (repo_root / ".cursorrules").read_text(encoding="utf-8"),
            )
            self.assertIn(
                "recursive-mode memory pointers",
                (repo_root / "CLAUDE.md").read_text(encoding="utf-8"),
            )
            self.assertIn(
                "recursive-mode memory pointers",
                (repo_root / ".github" / "copilot-instructions.md").read_text(encoding="utf-8"),
            )

    def test_installer_upserts_assistant_memory_pointers_without_removing_existing_content(self) -> None:
        with tempfile.TemporaryDirectory(prefix="install-recursive-mode-pointers-") as temp_dir:
            repo_root = Path(temp_dir) / "repo"
            github_root = repo_root / ".github"
            github_root.mkdir(parents=True, exist_ok=True)
            (repo_root / ".cursorrules").write_text("# Custom cursor notes\n", encoding="utf-8", newline="\n")
            (repo_root / "CLAUDE.md").write_text("# Team Claude notes\n", encoding="utf-8", newline="\n")
            (github_root / "copilot-instructions.md").write_text(
                "# Team Copilot notes\n",
                encoding="utf-8",
                newline="\n",
            )

            completed = subprocess.run(
                [sys.executable, str(MODULE_PATH), "--repo-root", str(repo_root)],
                text=True,
                capture_output=True,
                check=False,
            )

            self.assertEqual(
                completed.returncode,
                0,
                f"installer failed\nSTDOUT:\n{completed.stdout}\nSTDERR:\n{completed.stderr}",
            )
            self.assertIn("Custom cursor notes", (repo_root / ".cursorrules").read_text(encoding="utf-8"))
            self.assertIn("Team Claude notes", (repo_root / "CLAUDE.md").read_text(encoding="utf-8"))
            self.assertIn(
                "Team Copilot notes",
                (github_root / "copilot-instructions.md").read_text(encoding="utf-8"),
            )
            self.assertIn(
                "RECURSIVE-MODE-MEMORY-POINTERS:START",
                (repo_root / ".cursorrules").read_text(encoding="utf-8"),
            )
            self.assertIn(
                "RECURSIVE-MODE-MEMORY-POINTERS:START",
                (repo_root / "CLAUDE.md").read_text(encoding="utf-8"),
            )
            self.assertIn(
                "RECURSIVE-MODE-MEMORY-POINTERS:START",
                (github_root / "copilot-instructions.md").read_text(encoding="utf-8"),
            )

    def test_installer_upserts_root_agents_without_removing_existing_content(self) -> None:
        with tempfile.TemporaryDirectory(prefix="install-recursive-mode-agents-") as temp_dir:
            repo_root = Path(temp_dir) / "repo"
            repo_root.mkdir(parents=True, exist_ok=True)
            agents_path = repo_root / "AGENTS.md"
            agents_path.write_text("# Team Notes\n\nKeep this custom content.\n", encoding="utf-8", newline="\n")

            completed = subprocess.run(
                [sys.executable, str(MODULE_PATH), "--repo-root", str(repo_root)],
                text=True,
                capture_output=True,
                check=False,
            )

            self.assertEqual(
                completed.returncode,
                0,
                f"installer failed\nSTDOUT:\n{completed.stdout}\nSTDERR:\n{completed.stderr}",
            )
            updated = agents_path.read_text(encoding="utf-8")
            self.assertIn("Keep this custom content.", updated)
            self.assertIn("<!-- RECURSIVE-MODE-AGENTS:START -->", updated)

    def test_installer_upserts_recursive_md_without_replacing_existing_content(self) -> None:
        with tempfile.TemporaryDirectory(prefix="install-recursive-mode-recursive-upsert-") as temp_dir:
            repo_root = Path(temp_dir) / "repo"
            recursive_root = repo_root / ".recursive"
            recursive_root.mkdir(parents=True, exist_ok=True)
            recursive_path = recursive_root / "RECURSIVE.md"
            custom_header = "# My Repo\n\nCustom notes above the workflow.\n"
            recursive_path.write_text(custom_header, encoding="utf-8", newline="\n")

            completed = subprocess.run(
                [sys.executable, str(MODULE_PATH), "--repo-root", str(repo_root)],
                text=True,
                capture_output=True,
                check=False,
            )

            self.assertEqual(
                completed.returncode,
                0,
                f"installer failed\nSTDOUT:\n{completed.stdout}\nSTDERR:\n{completed.stderr}",
            )
            updated = recursive_path.read_text(encoding="utf-8")
            self.assertIn("Custom notes above the workflow.", updated)
            self.assertIn("<!-- RECURSIVE-MODE-CANONICAL:START -->", updated)
            self.assertIn("<!-- RECURSIVE-MODE-CANONICAL:END -->", updated)

    def test_installer_migrates_plain_recursive_md_to_marked_version(self) -> None:
        with tempfile.TemporaryDirectory(prefix="install-recursive-mode-recursive-migrate-") as temp_dir:
            repo_root = Path(temp_dir) / "repo"

            # First install: creates a marked RECURSIVE.md
            completed = subprocess.run(
                [sys.executable, str(MODULE_PATH), "--repo-root", str(repo_root)],
                text=True,
                capture_output=True,
                check=False,
            )
            self.assertEqual(
                completed.returncode,
                0,
                f"first install failed\nSTDOUT:\n{completed.stdout}\nSTDERR:\n{completed.stderr}",
            )
            recursive_path = repo_root / ".recursive" / "RECURSIVE.md"
            first_content = recursive_path.read_text(encoding="utf-8")
            self.assertIn("<!-- RECURSIVE-MODE-CANONICAL:START -->", first_content)

            # Re-install: must be idempotent — no content duplication
            completed2 = subprocess.run(
                [sys.executable, str(MODULE_PATH), "--repo-root", str(repo_root)],
                text=True,
                capture_output=True,
                check=False,
            )
            self.assertEqual(
                completed2.returncode,
                0,
                f"re-install failed\nSTDOUT:\n{completed2.stdout}\nSTDERR:\n{completed2.stderr}",
            )
            second_content = recursive_path.read_text(encoding="utf-8")
            self.assertEqual(first_content, second_content, "Re-install must not alter RECURSIVE.md content")
            # Canonical block must appear exactly once
            self.assertEqual(1, second_content.count("<!-- RECURSIVE-MODE-CANONICAL:START -->"))

    def test_installer_migrates_legacy_plain_recursive_md_without_duplication(self) -> None:
        """Simulates upgrading a repo that was bootstrapped with the old sync_plain_file installer."""
        with tempfile.TemporaryDirectory(prefix="install-recursive-mode-recursive-legacy-") as temp_dir:
            repo_root = Path(temp_dir) / "repo"
            recursive_root = repo_root / ".recursive"
            recursive_root.mkdir(parents=True, exist_ok=True)
            recursive_path = recursive_root / "RECURSIVE.md"

            # Simulate the old installer: write the canonical body as plain content (no markers)
            skill_root = Path(MODULE_PATH).resolve().parent.parent
            canonical_source = install.resolve_canonical_workflow_path(skill_root)
            canonical_body = install.normalize_plain_or_wrapped_content(
                canonical_source.read_text(encoding="utf-8"),
                "<!-- RECURSIVE-MODE-CANONICAL:START -->",
                "<!-- RECURSIVE-MODE-CANONICAL:END -->",
            )
            recursive_path.write_text(canonical_body + "\n", encoding="utf-8", newline="\n")
            self.assertNotIn("<!-- RECURSIVE-MODE-CANONICAL:START -->", recursive_path.read_text(encoding="utf-8"))

            # Run updated installer — should migrate to marked version, not duplicate content
            completed = subprocess.run(
                [sys.executable, str(MODULE_PATH), "--repo-root", str(repo_root)],
                text=True,
                capture_output=True,
                check=False,
            )
            self.assertEqual(
                completed.returncode,
                0,
                f"installer failed\nSTDOUT:\n{completed.stdout}\nSTDERR:\n{completed.stderr}",
            )
            updated = recursive_path.read_text(encoding="utf-8")
            self.assertIn("<!-- RECURSIVE-MODE-CANONICAL:START -->", updated)
            self.assertEqual(1, updated.count("<!-- RECURSIVE-MODE-CANONICAL:START -->"),
                             "Canonical block must not be duplicated on legacy migration")

    def test_powershell_installer_migrates_legacy_router_policy(self) -> None:
        powershell = shutil.which("pwsh") or shutil.which("powershell")
        if powershell is None:
            self.skipTest("PowerShell is required for installer parity tests")

        with tempfile.TemporaryDirectory(prefix="install-recursive-mode-ps1-") as temp_dir:
            repo_root = Path(temp_dir) / "repo"
            config_root = repo_root / ".recursive" / "config"
            config_root.mkdir(parents=True, exist_ok=True)
            legacy_policy_path = config_root / "recursive-router-cli.json"
            legacy_discovery_path = config_root / "recursive-router-cli-discovered.json"
            policy = router_lib.default_router_policy()
            role_routes = policy["role_routes"]
            assert isinstance(role_routes, dict)
            code_reviewer = role_routes["code-reviewer"]
            assert isinstance(code_reviewer, dict)
            code_reviewer["cli"] = "codex"
            code_reviewer["model"] = "gpt-5.4-mini"
            cli_overrides = policy["cli_overrides"]
            assert isinstance(cli_overrides, dict)
            cli_overrides["codex"] = {"command": "codex-router.exe"}
            legacy_policy_path.write_text(router_lib.pretty_json(policy), encoding="utf-8", newline="\n")
            legacy_discovery_path.write_text(
                router_lib.pretty_json(
                    router_lib.empty_discovery_inventory(
                        probe_tool="recursive-router-probe",
                        probe_status="complete",
                        clis=[{"id": "codex", "resolved_path": "C:/tools/codex-router.exe", "models": ["gpt-5.4-mini"]}],
                    )
                ),
                encoding="utf-8",
                newline="\n",
            )

            completed = subprocess.run(
                [powershell, "-NoProfile", "-File", str(MODULE_PATH.with_suffix(".ps1")), "-RepoRoot", str(repo_root)],
                text=True,
                capture_output=True,
                check=False,
            )

            self.assertEqual(
                completed.returncode,
                0,
                f"PowerShell installer failed\nSTDOUT:\n{completed.stdout}\nSTDERR:\n{completed.stderr}",
            )
            canonical_policy = json.loads((config_root / "recursive-router.json").read_text(encoding="utf-8"))
            self.assertEqual(canonical_policy["role_routes"]["code-reviewer"]["cli"], "codex")
            self.assertEqual(canonical_policy["role_routes"]["code-reviewer"]["model"], "gpt-5.4-mini")
            self.assertEqual(canonical_policy["cli_overrides"]["codex"]["command"], "codex-router.exe")
            self.assertFalse(legacy_policy_path.exists())
            self.assertFalse(legacy_discovery_path.exists())
            self.assertTrue((config_root / "recursive-router-discovered.json").exists())

    def test_powershell_installer_bootstraps_canonical_router_policy_defaults(self) -> None:
        powershell = shutil.which("pwsh") or shutil.which("powershell")
        if powershell is None:
            self.skipTest("PowerShell is required for installer parity tests")

        with tempfile.TemporaryDirectory(prefix="install-recursive-mode-ps1-defaults-") as temp_dir:
            repo_root = Path(temp_dir) / "repo"
            completed = subprocess.run(
                [powershell, "-NoProfile", "-File", str(MODULE_PATH.with_suffix(".ps1")), "-RepoRoot", str(repo_root)],
                text=True,
                capture_output=True,
                check=False,
            )

            self.assertEqual(
                completed.returncode,
                0,
                f"PowerShell installer failed\nSTDOUT:\n{completed.stdout}\nSTDERR:\n{completed.stderr}",
            )
            canonical_policy = json.loads((repo_root / ".recursive" / "config" / "recursive-router.json").read_text(encoding="utf-8"))
            self.assertEqual(router_lib.default_router_policy(), canonical_policy)

    def test_powershell_installer_source_includes_training_scaffold(self) -> None:
        ps1_script = MODULE_PATH.with_suffix(".ps1").read_text(encoding="utf-8")

        self.assertIn('Join-Path $memoryRoot "training"', ps1_script)
        self.assertIn("recursive-training-loader.py", ps1_script)
        self.assertIn("recursive-training-extract.py", ps1_script)
        self.assertIn('Join-Path $recursiveRoot "scripts"', ps1_script)

    def test_skills_cli_local_install_and_bootstrap_include_training_scaffold(self) -> None:
        if os.environ.get("RUN_SKILLS_CLI_INTEGRATION") != "1":
            self.skipTest("Set RUN_SKILLS_CLI_INTEGRATION=1 to enable local Skills CLI integration coverage")

        npx = shutil.which("npx")
        if npx is None:
            self.skipTest("npx is required for Skills CLI integration coverage")

        repo_root = Path(__file__).resolve().parent.parent
        with tempfile.TemporaryDirectory(prefix="install-recursive-mode-skills-cli-") as temp_dir:
            workspace = Path(temp_dir)
            try:
                install_completed = subprocess.run(
                    [
                        npx,
                        "skills",
                        "add",
                        str(repo_root),
                        "--skill",
                        "*",
                        "--full-depth",
                    ],
                    cwd=workspace,
                    text=True,
                    encoding="utf-8",
                    errors="replace",
                    capture_output=True,
                    check=False,
                    timeout=180,
                )
            except subprocess.TimeoutExpired as exc:
                self.skipTest(f"Skills CLI integration timed out: {exc}")
            combined_output = f"{install_completed.stdout}\n{install_completed.stderr}"
            if "ENOSPC" in combined_output or "no space left on device" in combined_output.lower():
                self.skipTest("Insufficient disk space for Skills CLI integration coverage")

            self.assertEqual(
                install_completed.returncode,
                0,
                f"skills add failed\nSTDOUT:\n{install_completed.stdout}\nSTDERR:\n{install_completed.stderr}",
            )

            installed_root_skill = workspace / ".agents" / "skills" / "recursive-mode"
            self.assertTrue(
                installed_root_skill.exists(),
                f"installed root skill missing\nSTDOUT:\n{install_completed.stdout}\nSTDERR:\n{install_completed.stderr}",
            )
            self.assertTrue((installed_root_skill / "skills" / "recursive-training" / "SKILL.md").exists())
            self.assertTrue((workspace / ".agents" / "skills" / "recursive-training" / "SKILL.md").exists())

            bootstrap_completed = subprocess.run(
                [
                    sys.executable,
                    str(installed_root_skill / "scripts" / "install-recursive-mode.py"),
                    "--repo-root",
                    str(workspace),
                ],
                cwd=workspace,
                text=True,
                capture_output=True,
                check=False,
            )
            self.assertEqual(
                bootstrap_completed.returncode,
                0,
                f"installed bootstrap failed\nSTDOUT:\n{bootstrap_completed.stdout}\nSTDERR:\n{bootstrap_completed.stderr}",
            )

            self.assertTrue((workspace / ".recursive" / "memory" / "training" / ".gitkeep").exists())
            self.assertTrue((workspace / ".recursive" / "scripts" / "recursive-training-loader.py").exists())
            self.assertTrue((workspace / ".recursive" / "scripts" / "recursive-training-sync.py").exists())
            self.assertTrue((workspace / ".recursive" / "scripts" / "recursive-training-extract.py").exists())
            self.assertTrue((workspace / ".cursorrules").exists())
            self.assertTrue((workspace / "CLAUDE.md").exists())
            self.assertTrue((workspace / ".github" / "copilot-instructions.md").exists())

            installed_recursive = (workspace / ".recursive" / "RECURSIVE.md").read_text(encoding="utf-8")
            self.assertIn("/.recursive/memory/training/", installed_recursive)
            self.assertIn("recursive-training-loader.py", installed_recursive)

    def test_repo_root_router_policy_is_not_personalized(self) -> None:
        repo_root = Path(__file__).resolve().parent.parent
        policy_path = repo_root / ".recursive" / "config" / "recursive-router.json"
        self.assertTrue(policy_path.exists())
        policy = json.loads(policy_path.read_text(encoding="utf-8"))
        self.assertEqual(router_lib.default_router_policy(), policy)

    def test_repo_root_router_discovery_inventory_is_not_bootstrapped(self) -> None:
        repo_root = Path(__file__).resolve().parent.parent
        discovery_path = repo_root / ".recursive" / "config" / "recursive-router-discovered.json"
        self.assertFalse(discovery_path.exists())

    def test_root_lockfile_requires_root_package_manifest(self) -> None:
        repo_root = Path(__file__).resolve().parent.parent
        if (repo_root / "package-lock.json").exists():
            self.assertTrue((repo_root / "package.json").exists())


if __name__ == "__main__":
    unittest.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: 466kUpdated Claude CodeCodexVerifiedInstall
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: 466kUpdated 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: 319kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 319kUpdated Claude CodeCodexVerifiedInstall