Repository navigation
Description
Parent
Refs #3801
Agent Brief
Type: Feature
Summary: A map-landscape skill in the architecture plugin that emits a C4 System Landscape plus an application-portfolio table over a discovered set of repositories, with a thin setup skill owning the consumer's architecture declaration.
Current behavior:
No skill answers "what systems does this organization have, who owns them, what do they run on, and how do they relate". Repository-fleet discovery exists in the fleet-hygiene plugin but feeds cleanup, not an architecture view. No plugin or convention declares where a consumer keeps architecture artifacts.
Desired behavior:
A skill that discovers a set of repositories, then emits two artifacts into the consumer's declared architecture home.
Discovery, by argument (the argument selects the mode):
--repos <path>[,<path>...]: exactly those repositories, no discovery.--root <dir>(repeatable): discovery. When therepo-fleet-hygieneplugin is installed it owns bounded fleet discovery and canonical-checkout resolution: invoke/repo-fleet-hygiene:audit <root>... --plan-file <memory_dir>/<topic-slug>/fleet-plan.jsonvia the Skill tool (resolve the slug per the topic-docs binding andmkdir -pthe slice first), confirm the plan'sschema_versionis1, readrepositories[], keep only entries whosediscoveredpath lies under a requested root (the collaborator's config-supplied scope is additive, so an unfiltered read can chart the operator's whole configured fleet), and usecanonicalandremote. When the plugin is absent, or the plan file is missing or carries anotherschema_version: bundled walk, recurse from each root to depth 5, a.gitentry is a repository and is not descended into, skipnode_modules,vendor,.venv, canonical checkout = first record ofgit worktree list --porcelain. Announce the fallback. Announce that the collaborator's audit collects GitHub evidence and may needghauthentication.- Neither argument: stop and name both forms. Never scan the session's working directory.
Facts per repository come from the helper script, run as ${CLAUDE_SKILL_DIR}/scripts/portfolio-facts.sh <repo-path>... (the anchor matters; a bare relative path resolves against the session cwd), never derived by hand. Bash, POSIX awk/grep, no grep -P; one JSON object per repository on stdout: name, path, remote, owner, runtime, target_framework, dependencies[], last_touched, evidence{}; unknown for anything underivable, never a guess. Probes, first hit wins:
owner:CODEOWNERS(root,.github/,docs/) default*rule's first owner → owner segment of theoriginremote URL →unknown. Never commit authors.runtime:*.csproj/*.fsproj/global.json→dotnet;package.json→node(orbun/denoby lockfile or config);pyproject.toml/requirements*.txt/setup.py→python;go.mod→go;Cargo.toml→rust;pom.xml/build.gradle*→jvm;Gemfile→ruby;composer.json→php; only*.sh/*.ps1→shell; elseunknown. Multiple hits list all, first is primary.target_framework:<TargetFramework(s)>from the first*.csproj;engines.node;requires-python;godirective;rust-version/edition; elseunknown.dependencies:PackageReference/ProjectReferenceincludes;dependencies+peerDependencieskeys;[project].dependencies/requirements*.txtnames;go.modrequireblock;Cargo.toml[dependencies]; capped at 25, sorted, deduplicated.last_touched:git log -1 --format=%cIon the canonical checkout (local HEAD; nothing fetches).
Relationships are model judgment with cited evidence: an edge A → B exists only when a fact in A names B (dependency name equals B's repository name or package id, a ProjectReference/workspace path resolves into B, or B's remote URL appears in A's tracked config or README); the edge description is the matched string. No cited match, no edge.
Artifact one, <architecture_dir>/landscape.dsl when the dialect is structurizr: a workspace with a model of softwareSystem elements and -> relationships and views { systemLandscape "landscape" { include * autoLayout } }. Or <architecture_dir>/landscape.md when the dialect is mermaid: a C4Context block titled "System Landscape" with no focal system, every repository a System, grouped by Enterprise_Boundary per remote owner when more than one owner is present, Rel lines per the evidence rule, inside a mermaid fence. The skill body states that mermaid has no dedicated landscape diagram type and that upstream marks its C4 syntax experimental (source https://mermaid.js.org/syntax/c4.html, verified 2026-09-06; recheck when a mermaid release adds a landscape type or drops the notice).
Artifact two, <architecture_dir>/portfolio.md: heading, generated-on line (date and discovery source: explicit list / fleet-hygiene plan / bundled walk), one table Repository | Owner | Target framework | Runtime | Dependencies | Last touched (local HEAD), one row per repository sorted by name, unknown rendered as-is, dependencies comma-joined and truncated to 10 with (+N).
Architecture home and dialect resolve from a consumer topic doc <convention-home>/architecture/README.md carrying a fenced YAML block with architecture_dir (repo-relative, no default) and landscape_dialect (structurizr | mermaid, default mermaid). The convention home resolves through the vendored ${CLAUDE_PLUGIN_ROOT}/lib/resolve-convention-home.sh (exit 0 resolved, 1 no pointer, 2 usage, 3 FAIL); the skill runs it and follows the exit code, never parsing the root file. Ladder per key: topic doc → infer from repo evidence (an existing *.dsl → structurizr; an existing docs/architecture/ or architecture/ → that dir) → ask once → landscape_dialect defaults to mermaid; architecture_dir has no silent default: undeclared and unconfirmed (including non-interactive runs) the skill stops and points at /architecture:setup. Inference proposes; only confirmation binds. map-landscape never writes the consumer's root instruction file.
architecture:setup owns the declaration, mirroring plugins/plugin-quality/skills/setup/SKILL.md (minus its retirement records). Frontmatter: user-invocable: true, disable-model-invocation: true, NO metadata block (the cheat-sheet generator excludes every skill named setup and scripts/validate-plugins.sh fails when one carries workflow-stage/summary/cadence), and the double-quoted argument-hint: "check | apply [home=<dir>] [architecture_dir=<path>] [landscape_dialect=<structurizr|mermaid>]" (scripts/validate-plugin-contracts.mjs requires check leading and the body to document both check and apply in code spans). check is read-only: runs the resolver and prints a PASS/FAIL/INFO table with one remediation line per FAIL, covering no pointer line (resolver exit 1), a resolved home with no architecture/README.md, a topic doc with an unknown key or value, and a conforming declaration. apply converges the marked convention-home pointer region in the root instruction file (inside the markers only, preserving unrelated content, only when home= is supplied or a home is confirmed) and the architecture/README.md topic doc at the resolved home. It is idempotent; proposes inferred values and waits for confirmation when arguments are incomplete; runs non-interactively when home=, architecture_dir=, and landscape_dialect= are all supplied; and after writing re-reads and reports the stored values it observed. No retired layers.
Skill content is organization-agnostic: no organization or publisher name appears anywhere in either skill body; no Zachman or TOGAF prose; C4 and Structurizr are named as output formats only.
Key interfaces:
/architecture:map-landscape [--repos <a,b>] [--root <dir>].../repo-fleet-hygiene:audit ... --plan-file <path>(presence-gated; readsschema_version,repositories[].discovered,.canonical,.remote)${CLAUDE_SKILL_DIR}/scripts/portfolio-facts.shJSON contract above<convention-home>/architecture/README.mdkeysarchitecture_dir,landscape_dialect; contract documented inplugins/architecture/reference/config.md, cited from skills as${CLAUDE_PLUGIN_ROOT}/reference/config.md(a barereference/config.mdfails skill-quality check 5)/architecture:setup check | apply [home=<dir>] [architecture_dir=<path>] [landscape_dialect=<structurizr|mermaid>]
Files:
plugins/architecture/skills/map-landscape/SKILL.md(frontmatter asskills/improve/SKILL.md:descriptionwith "Use when:" and a "Skip when:" naming/architecture:improveand/repo-fleet-hygiene:audit,argument-hint,user-invocable: true, explicitdisable-model-invocation: false,shell: bash,metadata.workflow-stage: explore,metadata.summary≤ 100 codepoints; under 200 lines; sections: Repository context, Purpose, Resolve home and dialect, Discover repositories, Collect facts, Draw relationships, Emit artifacts with one minimal fenced example per dialect, What this skill does NOT do, Gotchas. Gotchas carry: the mermaid asymmetry and experimental notice with source and date; theownerladder; local-HEAD last-touched; the fleet plan is a temp artifact in the memory slice, never committed)plugins/architecture/skills/map-landscape/scripts/portfolio-facts.shandportfolio-facts.test.sh(fixtures created inmktemp -dby the test: csproj withTargetFrameworkand twoPackageReferences;package.jsonwithengines.nodeand dependencies;pyproject.toml;go.mod; empty repo; repo withCODEOWNERS; repo withoriginremote and no CODEOWNERS; eachgit initplus one commit; asserts every field,unknownon the empty repo, the dependency cap, the owner ladder order; skill-script shape perdocs/conventions/shell-test-helpers/README.md)plugins/architecture/skills/map-landscape/evals/evals.jsonplus fixtures, every fixture referenced by a case'sfiles[]. Cases: explicit list with the collaborator absent; root with the collaborator installed; root with the collaborator absent; dialectstructurizrfrom a topic doc; no topic doc and no inference evidence; no scope at allplugins/architecture/skills/setup/SKILL.mdplusevals/evals.json(setup skills are not evals-exempt). Cases:checkwith no pointer line (FAIL row plus remediation);checkwith a conforming doc (all PASS);applywith incomplete arguments proposes and waits;applywith complete arguments writes without prompting and reports the read-back valuesplugins/architecture/lib/resolve-convention-home.sh: add the path tocopies=(...)inscripts/sync-resolve-convention-home.sh, then run the script to copy; never edit the canonical copy inplugins/claude-config/lib/plugins/architecture/reference/config.md(new; modelled onplugins/plugin-quality/reference/config.md, 4-backtick outer fence around the example, keys table statingarchitecture_dirhas no default andlandscape_dialectdefaults tomermaid, no retired-layers section)plugins/architecture/README.md("Invoke" block, trigger phrases, a "Consumer configuration" pointer)plugins/architecture/CHANGELOG.md## [0.7.0]### Addedwith a bold "New skill" lead per new skill;plugins/architecture/.claude-plugin/plugin.jsonversion0.7.0, extendeddescription,keywords+c4,landscape,portfolio;.claude-plugin/marketplace.jsontagskept identical tokeywordsdocs/conventions/config-cascade/README.mdImplementers table: add thearchitecturerow (path = convention doc<home>/architecture/README.md; layers =team, via pointer line; conformance = new surface under the expression doctrine, no retirement record; keys owned by the plugin'sreference/config.md)- Regenerate
docs/SKILL-CHEAT-SHEET.mdanddocs/CATALOG.mdwithscripts/generate-cheatsheet.mjsandscripts/generate-catalog.mjs; never hand-edit
Sanity checks. Run git fetch origin main first (the base ref is also CHECK_SKILL_BASE_REF). All must hold before opening the PR. Commands are given in a fenced block so nothing is markdown-escaped; the dots in the last grep stand for the backticks around the surface name (a backslash-backtick inside grep -E is a buffer-start anchor and never matches):
test -d plugins/architecture/skills/map-landscape && test -f plugins/architecture/skills/setup/SKILL.md
test -f plugins/architecture/lib/resolve-convention-home.sh && grep -q 'plugins/architecture/lib/resolve-convention-home.sh' scripts/sync-resolve-convention-home.sh && bash scripts/sync-resolve-convention-home.sh --check
! grep -qi 'melodic' plugins/architecture/skills/map-landscape/SKILL.md && ! grep -qi 'melodic' plugins/architecture/skills/setup/SKILL.md
! grep -qiE 'zachman|togaf' plugins/architecture/skills/map-landscape/SKILL.md && ! grep -qiE 'zachman|togaf' plugins/architecture/skills/setup/SKILL.md
grep -q 'repo-fleet-hygiene' plugins/architecture/skills/map-landscape/SKILL.md && grep -qi 'plugin is installed' plugins/architecture/skills/map-landscape/SKILL.md && grep -q 'systemLandscape' plugins/architecture/skills/map-landscape/SKILL.md && grep -q 'C4Context' plugins/architecture/skills/map-landscape/SKILL.md
grep -q '^## \[0.7.0\]' plugins/architecture/CHANGELOG.md && grep -q 'map-landscape' plugins/architecture/README.md && grep -q 'map-landscape' docs/SKILL-CHEAT-SHEET.md
grep -qE '^\| *.architecture. *\|' docs/conventions/config-cascade/README.md # fails on today's main: the word does not occur in that file
bash plugins/architecture/skills/map-landscape/scripts/portfolio-facts.test.sh
shellcheck plugins/architecture/skills/map-landscape/scripts/*.sh
bash scripts/check-changed-skills.sh origin/main
bash scripts/validate-plugins.sh
bash scripts/check-skill-count-claims.sh --check
bash scripts/check-orphaned-fixtures.sh --check
bash scripts/check-changelog-parity.sh --check-bump origin/main && bash scripts/check-changelog-parity.sh --check-preserved origin/main && bash scripts/check-changelog-parity.sh --check-order
npx markdownlint-cli2 <every changed markdown file> # 0 issuesAcceptance criteria:
- Running the skill with
--reposand the fleet-hygiene plugin absent produces both artifacts over exactly the listed repositories (manual smoke, recorded in the PR body). - With the fleet-hygiene plugin installed and
--rootgiven instead of an explicit list, the skill invokes its audit with--plan-fileand uses the canonical repositories under that root (manual smoke, recorded in the PR body). - With neither
--reposnor--root, the skill stops and names both forms. - The emitted portfolio table has one row per discovered repository and carries all five columns.
- The emitted landscape view is a C4 System Landscape in the dialect the consumer's topic doc names (Structurizr
systemLandscape, or mermaidC4Contextwith the stated asymmetry) (manual smoke). - Both artifacts are written to the declared
architecture_dir; with none declared and none confirmed the skill stops and points at/architecture:setup(manual smoke). -
architecture:setup checkreports the declaration state read-only;applyconverges the pointer region and topic doc idempotently, runs non-interactively with complete arguments, and reports read-back values. - No organization or publisher name, and no Zachman or TOGAF prose, appears in either skill's content.
-
portfolio-facts.test.shpasses and every sanity check above holds. -
bash scripts/check-changed-skills.sh origin/mainpasses for both new skills. -
markdownlintpasses on the changed files. - The architecture plugin version is
0.7.0with a matching CHANGELOG entry. - The architecture plugin README,
reference/config.md, the config-cascade Implementers row, and the regenerated cheat sheet and catalog document the new skills.
Out of scope:
- Baseline-versus-target gap analysis.
- Container-level or component-level C4 views.
- Modifying any discovered repository.
- Any write to the consumer's root instruction file outside the marked
convention-homeregion. - Capability maps and work-breakdown structures.
Amendment note (2026-09-06, planning slice #3807)
This body is the worker's complete contract. The planner's record (docs/topics/cross-repo-landscape/PLAN.md on branch plan/3807-cross-repo-landscape) is contract-tier and never merges, so it is not reachable from a branch cut from main; nothing in it is needed beyond what is here. Changes from the original brief: (1) criterion 2 reworded, /repo-fleet-hygiene:audit stops without a scope, so "no explicit list" means a --root scan root, not no argument, and an explicit list bypasses discovery outright; (2) the "declared architecture home" mechanism did not exist and is created here as a convention doc plus a required architecture:setup skill whose apply converges the pointer region like the pilot's (plugin philosophy: a consumer configuration surface requires setup); (3) mermaid has no landscape diagram type, so the mermaid output is a C4Context with the asymmetry stated; (4) the facts collector is a tested script; (5) the fleet plan read is filtered to the requested roots because the collaborator's configured scope is additive; (6) criteria no repository gate can verify are marked manual smoke.
Activity
kyle-sexton commentedon Sep 6, 2026
fix(architecture): stop --help leaking shell source past the header
fix(architecture): stop map-landscape fabricating an owner and readin…
fix(architecture): stop a port in the authority becoming the owner
fix(architecture): stop map-landscape fabricating an owner and readin…