
Dev Context Multi Repo
- 45 installs
- 73 repo stars
- Updated July 13, 2026
- vasilyu1983/ai-agents-public
Helps with ai & agent building tasks.
About
dev-context-multi-repo is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.
- dev-context-multi-repo
- AI & Agent Building
- AI-coding skill
Dev Context Multi Repo by the numbers
- 45 all-time installs (skills.sh)
- +10 installs in the week ending Aug 5, 2026 (Skillselion tracking)
- Ranked #7,749 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/vasilyu1983/ai-agents-public --skill dev-context-multi-repoAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 45 |
|---|---|
| repo stars | ★ 73 |
| Last updated | July 13, 2026 |
| Repository | vasilyu1983/ai-agents-public ↗ |
What it does
Helps with ai & agent building tasks.
Files
Multi-Repo Context
Use this skill to inventory, normalize, and publish one coherent knowledge hub for many repositories. The strongest default is a two-layer system: raw source captures plus an LLM-maintained compiled markdown hub with profiles, concept pages, backlinks, and derived reports. It owns repo discovery, high-signal extraction, cross-repo inference, artifact-set generation, and knowledge-graph assembly. It does not replace single-repo context or code-graph work.
Quick Reference
| Task | Use |
|---|---|
| Discover repos and classify portfolio shape | scripts/discover_repos.py, references/repo-discovery-patterns.md |
| Scan repos into normalized profiles | scripts/scan_repo.py, scripts/scan_portfolio.py, references/repo-classification-rules.md |
| Build standard artifact set | scripts/build_artifact_set.py, references/output-model-and-gap-analysis.md |
| Build and validate graph outputs | scripts/build_knowledge_graph.py, scripts/validate_graph.py, scripts/check_graph_consistency.py, references/knowledge-graph-patterns.md |
| Calibrate graph edge weights from evidence | scripts/calibrate_weights.py, references/knowledge-graph-patterns.md |
| Query graph neighborhoods, paths, impact, rank, PPR, and communities | `scripts/query_graph.py --node\ |
| Detect communities (Louvain) and generate per-community summaries | scripts/query_graph.py --communities --resolution, assets/community-summary-template.md |
| Bitemporal time-slice queries | scripts/query_graph.py --as-of <date> --known-at <date>, references/knowledge-graph-patterns.md §12 |
| Create or operate a coordination hub | assets/coordination-repo-layout-template.md, references/hub-operations-playbook.md |
| Run a raw-ingest to compiled-wiki loop | the docs-notes-retrieval skill, references/hub-design-patterns.md, references/hub-operations-playbook.md |
| Freshness and drift checks | scripts/report_drift.py, scripts/check_hub_freshness.sh, references/hub-freshness-checking.md |
When to Use
- Build a master context repo or docs hub for many services or repositories.
- Produce one normalized profile per repo instead of ad hoc summaries.
- Generate consistent repo descriptions from structured JSON profiles and graph edges instead of freehand summaries.
- Classify complex orchestration repos such as agent runtimes, remote bridges, terminal-first CLIs, plugin hosts, and worktree coordinators without collapsing them into
unknown. - Map stacks, interfaces, dependencies, owners, and integration edges across a portfolio.
- Generate hub artifacts for onboarding, migration planning, architecture review, or RAG.
- Retrofit a knowledge graph onto an existing coordination hub.
- Operate a
raw/evidence layer plus a compiled markdown wiki for a repo portfolio. - Maintain or refresh a large repo portfolio, including 100+ repo hubs where incremental compilation matters more than one-shot summarization.
Recreate a Requirements-Hub
A ready-to-copy blank hub ships at assets/hub-scaffold/. It is the same shape this skill produces — hot layer (AGENTS.md, rules/), compiled layer (context/), and one example domain folder — with zero organization-specific content.
cp -r assets/hub-scaffold ~/repos/requirements-hubThen follow assets/hub-scaffold/context/scripts/README.md for the end-to-end command sequence: discover_repos.py → scan_portfolio.py → build_knowledge_graph.py → query_graph.py --rank → validate_graph.py, then build/validate the hub's own context graph with the reused dev-context-engineering scripts. The scaffold's rules/ stubs point at the clearly-labelled generic templates in dev-context-engineering/assets/ — swap each regime reference for your own regulatory context.
Route Elsewhere
- Single-repo context layers and rollout across tools: use dev-context-engineering.
- Symbol or file graph inside one repo: use dev-context-code-graph.
- Spec writing or decision docs: use docs-ai-prd.
- Documentation freshness audits: use qa-docs-coverage.
- Parallel discovery across many repos with explicit delegation: use agents-swarm-orchestration.
Defaults
- Structured metadata first, narrative second.
- One canonical profile per repo.
- Raw ingest first, compiled wiki second.
- Treat repo knowledge as the system of record and keep root agent files as maps, not encyclopedias.
- Use just-in-time loading by default: store stable identifiers, paths, graph node IDs, and report links, then load the relevant artifact at task time.
- High-signal file reads before deep reads.
- Separate raw evidence, normalized metadata, and human summaries.
- Prefer markdown-native index pages, summaries, and backlinks before adding heavier retrieval layers.
- Let the LLM maintain the compiled hub; humans review, prune, and correct drift instead of hand-editing every page.
- File durable answers, diagrams, and reports back into the hub so portfolio queries compound over time.
- Treat hidden differentiators as first-class extraction targets: transport model, control plane, permission bridge, session lifecycle, worktree model, plugin lifecycle, and recovery policy are often more important than language or package metadata.
- Mark claims as
verified,subset-verified,inferred, orunverifiedwhen coverage is incomplete. - Keep generated artifacts under one artifact root instead of scattering them through docs.
- Do not create free-floating Markdown reports for every portfolio query; route reusable outputs into the hub catalog, reports lifecycle, or generated context artifact set.
May 2026 Stance
The current best default is not "index everything and stuff it into a prompt." Build a small, navigable context system that can select the right evidence at runtime.
- Keep
AGENTS.mdand sibling runtime files short; they should route agents to the hub, not duplicate the hub. - Make structured artifacts the compiler inputs: profiles, code graphs, system edges, freshness reports, and evidence refs.
- Make markdown the operator surface: catalog pages, concept notes, architecture maps, and reusable query outputs.
- Use graph traversal when relationship structure changes the answer: dependency paths, ownership, blast radius, shared providers, cross-repo flows, migration seams, or "catch me up on this system" questions.
- Use lexical search, index pages, or direct file reads for simple lookup questions; graph-first retrieval for every query adds latency and noise.
- Use Personalized PageRank when the question is seeded by a repo/domain/process but needs budget-bounded context beyond a 1-2 hop neighborhood.
- Use community detection (
--communities) at multiple resolutions when the question is global ("what does the platform look like?") and a single-seed walk would miss the structure. Drop in Leiden viaigraphorgraspologicwhen you need stronger connectedness guarantees on portfolios > 1k nodes. - Calibrate weights when prose, Mermaid, manifests, and schemas all contribute edges; direct multi-source evidence should outrank single-source prose edges.
- Keep symbol-level graphs as per-repo artifacts from
dev-context-code-graph; import summaries or links into the hub instead of merging every symbol into the portfolio graph. - Apply context-hygiene gates before publishing: relevance, provenance, freshness, ACL/sensitivity scope, contradiction risk, and bounded token shape.
- Prefer dynamic pruning of irrelevant graph communities or subgraphs over static "include the whole graph" prompts.
Workflow
1. Inventory candidate repos and classify repo shape. 2. Index raw evidence first: repo roots, architecture docs, API contracts, datasets, screenshots, and other source captures should live in a raw layer instead of being flattened into summaries. 3. Read only high-signal manifests, docs, CI files, schema clues, and instruction artifacts. 4. Normalize evidence into one RepoProfile per repo. 5. If the repo appears to be an orchestration-heavy runtime, deepen the scan around transport, remote/session, approval, worktree, plugin, and recovery files before accepting a generic classification. 6. Infer repo kind, interfaces, dependencies, storage, ownership, and capability families without overclaiming. 7. Generate or refresh one repo description per repo from the normalized profile and relationship edges, with confidence labels derived from evidence coverage. 8. Compile the markdown hub incrementally: repo catalog pages, cross-repo concept notes, backlinks, and index files that help the agent navigate without scanning the whole corpus every time. 9. Rebuild only the changed pages, indexes, and graph edges when possible; do not re-summarize the whole portfolio by default. 10. Materialize the artifact set: profiles, catalog pages, graphs, and reports. 11. Validate graph consistency and freshness, then run hub health checks for stale claims, missing summaries, unindexed reports, and candidate pages worth adding before calling the hub current.
ASCII Flow
multi-repo context request
-> discover repos and classify portfolio shape
-> ingest raw evidence without flattening it into prose
-> scan high-signal files into one RepoProfile per repo
-> build compiled hub: catalog pages, indexes, backlinks, reports
-> build graph artifacts: system edges and knowledge graph
-> query with lexical search, direct reads, graph paths, PPR, or communities
-> validate coverage, freshness, consistency, and unindexed outputs
-> publish only durable hub artifacts, not free-floating reportsCore Decisions
Output Model
Default artifact set:
profiles/<repo>.jsoncatalog/<repo>.mdgraphs/system-edges.jsongraphs/knowledge-graph.jsonreports/coverage.mdreports/drift.json
Do not invent alternate shapes unless there is a downstream consumer that requires a transform layer.
Treat catalog/ and reports/ as the compiled markdown layer by default. Add folders such as concepts/ or research/ only when there is a clear downstream consumer for concept articles or query outputs.
The repo description page should usually be generated from:
- verified fields in
profiles/<repo>.json - relationship edges from
graphs/system-edges.json - a bounded set of direct evidence references
Do not let the description page become an ungrounded prose summary.
For complex repos, the profile should capture capability families rather than only surface metadata. A strong profile often needs fields or derived sections for:
- runtime or deployment mode
- control-plane and transport model
- remote or bridge responsibilities
- session and resume semantics
- permission and approval path
- worktree or parallel-task isolation model
- plugin, hook, or hot-reload lifecycle
- recovery or retry policy
Extraction Strategy
Start from files that reveal repo reality quickly:
- manifests and lockfiles
- CI workflows
- container and infra files
- native/mobile project manifests such as
Package.swift,project.yml,.xcodeproj, and.xcworkspace - schema and migration files
- API contracts
- repo instruction files
- specs and plans
If the hub also stores non-repo evidence, keep those captures in the raw layer and summarize them into the compiled hub rather than treating screenshots, exports, or article clips as first-class catalog pages.
Use deep reads only when the high-signal layer is insufficient to classify the repo or prove an integration.
For orchestration-heavy repos, the high-signal layer must include runtime spine files, not just manifests:
- transport implementations
- remote bridge or client/server session managers
- permission and approval bridge code
- worktree and task orchestration setup
- plugin, hook, and hot-reload loaders
- reconnect, backpressure, batching, and recovery logic
Many of the most important differentiators are invisible in package metadata. If the extractor only sees language, lockfiles, and README text, it will under-classify repos that actually win on runtime design.
Complex Runtime Classification
When a repo contains files or modules for multiple of the following, prefer a complex-runtime classification over unknown:
- remote bridge or remote execution support
- explicit transport abstractions such as SSE, WebSocket, or hybrid read/write transport
- session manager or resume lifecycle
- permission or approval mediation
- task, coordinator, teammate, or worker orchestration
- worktree creation, branch isolation, or tmux/session bootstrapping
- plugin, hook, or lazy-loader infrastructure
- explicit recovery, retry suppression, buffering, or backpressure mechanisms
Typical classifications worth recognizing:
- agent runtime
- coding-agent CLI
- remote execution bridge
- terminal UI host
- plugin platform
- multi-repo coordinator
Verification Scope
Before synthesis:
- separate direct evidence from inferred structure
- avoid portfolio-wide universal claims unless every relevant repo was checked
- verify storage engines from manifests and drivers, not from README prose
- mark partial coverage explicitly in summaries and tables
For generated repo descriptions:
- distinguish what is proven from manifests or workflows vs what is inferred from naming or topology
- prefer concise, structured descriptions over narrative confidence theater
- include unknowns explicitly when a repo cannot be confidently classified
Knowledge Graph
Use the knowledge graph when the hub needs queryable relationships across repos, systems, and artifacts. Keep symbol-level graph work out of this layer; that belongs to single-repo code-graph workflows.
The graph complements the markdown hub; it does not replace it. The best default is graph-backed markdown pages with backlinks, index notes, and concise summaries that an agent can read directly at small and medium corpus sizes.
For complex runtimes, add capability and behavior edges, not just dependency edges. Useful examples:
uses_transportsplits_read_write_channelssupports_resumable_streamsbridges_permissionsmanages_remote_sessionssupports_worktree_isolationsupports_plugin_hot_reloadserializes_writesbuffers_stream_eventshas_recovery_policy
Q&A and Derived Outputs
Prefer answers as files, not terminal-only output:
- markdown reports for architecture questions or migration maps
- Mermaid or other diagrams for relationship views
- slide or image outputs when a viewer exists and the question is presentation-heavy
If an answer will likely be useful again, file it back into the hub and link it from the relevant repo or concept page.
Before adding the file, run the hub placement test:
- does this belong in an existing repo catalog, concept page, or report?
- will it be linked from the hub index or related repo page?
- is it generated from structured inputs, and if so is the rebuild command known?
- does it have a lifecycle state if it is a point-in-time analysis?
If not, keep it in the task thread or update an existing hub page.
Operating at 100+ Repos
At large portfolio scale, optimize for maintenance loops, not heroic one-off scans:
- keep a registry of repos and last-refresh state
- compile incrementally instead of rebuilding every page on every run
- maintain short index pages that help the LLM find the right repo or concept quickly
- prefer JSON + markdown + graph artifacts that can be diffed, linted, and repaired
- add lightweight CLIs for search, freshness checks, and targeted rebuilds before reaching for heavier retrieval systems
Hub Layout
Prefer a coordination repo with:
- root entry files
- domain folders at the root
- generated hub infrastructure under
context/ordocs/context/ - optional
raw/capture areas for evidence the LLM compiles into the hub
Keep the root navigation-focused. Do not paste inventories into AGENTS.md.
For native/mobile repos, the default scanner should classify from high-signal project files before falling back to generic language heuristics. Swift/Xcode repos should resolve cleanly as app repos when project.yml, .xcodeproj, or .xcworkspace evidence is present, and scans should ignore generated build trees such as .build, DerivedData, Pods, and SourcePackages.
Output Modes
Default to one of these:
- Portfolio inventory:
repo registry, classifications, and scan coverage.
- Context hub:
profiles, catalog pages, relationship edges, and knowledge graph.
- Compiled wiki:
raw evidence registry, markdown indexes, concept notes, backlinks, and reusable query outputs.
- Repo description set:
one grounded page per repo compiled from profile JSON, graph edges, and verified evidence.
- Capability map:
per-repo runtime capabilities, differentiators, and operational behaviors derived from source evidence rather than README-level summaries.
- Migration map:
active vs legacy systems, integration edges, and transition hotspots.
- Freshness report:
drift, stale documents, and re-verification queue.
Known Traps
- Accepting a generic repo classification too early and missing the operational behavior that actually distinguishes orchestrators, bridges, or control planes.
- Reading README-heavy repos as if they were authoritative when manifests, workflows, and runtime scripts say something else.
- Rebuilding the full hub on every scan instead of compiling incrementally from the repos that actually changed.
- Letting inferred cross-repo edges harden into "facts" before they are traced back to manifests, schemas, or concrete integration evidence.
- Using portfolio summaries as the source of truth while raw evidence and normalized profiles quietly drift underneath them.
- Treating a longer model context window as permission to load the whole hub; large irrelevant context still causes distraction and context rot.
- Applying GraphRAG or graph traversal to every question even when a direct catalog lookup, lexical search, or bounded file read is more accurate.
- Letting generated markdown and generated JSON drift independently instead of regenerating prose from the structured profile and graph contracts.
- Re-ingesting LLM-generated summaries as fresh evidence without keeping the original source and timestamp.
Anti-Patterns
- Treating one repo summary as a portfolio model.
- Claiming complete coverage without a verified scan registry.
- Mixing raw evidence, normalized data, and commentary in the same file.
- Verifying storage or runtime claims from docs instead of manifests.
- Leaving useful portfolio answers in chat output instead of filing them back into the hub.
- Pasting portfolio inventories into root agent-memory files.
- Forcing symbol-level code graphs into the portfolio knowledge graph.
- Reaching for heavy RAG before maintaining index pages, concise summaries, and backlinks.
- Rebuilding 130 repo descriptions from scratch when only a subset changed.
- Writing repo descriptions directly from chat impressions instead of profile JSON and graph edges.
- Letting complex repos remain
unknownbecause the scanner only looked at manifests and README text. - Modeling only dependency edges and missing operational edges such as permission bridges, session control planes, resumable streams, or worktree isolation.
- Using a vector database, GraphRAG stack, or MCP server as a substitute for repo-owned profiles, evidence refs, and freshness checks.
- Publishing "complete codebase context" claims without parse coverage, scan date, excluded paths, and unsupported-language notes.
- Mixing public docs, private code evidence, secrets, and customer data in one context layer without sensitivity labels and access boundaries.
Navigation
- Core references: references/repo-discovery-patterns.md, references/repo-classification-rules.md, references/architecture-inference-rules.md, references/integration-signal-detection.md, references/confidence-scoring.md
- Hub and graph operations: references/output-model-and-gap-analysis.md, references/knowledge-graph-patterns.md, references/hub-design-patterns.md, references/hub-operations-playbook.md, references/hub-freshness-checking.md, references/large-portfolio-strategy.md
- references/network-science-applied.md — Centrality, PageRank, community detection, contagion applied to multi-repo knowledge graphs and portfolio topology.
- Assets: assets/hub-scaffold/ (copy-paste blank hub — see "Recreate a Requirements-Hub"), assets/coordination-repo-layout-template.md, assets/repo-catalog-page-template.md, assets/architecture-map-template.md, assets/integration-matrix-template.md, assets/freshness-report-template.md, assets/legacy-transition-map-template.md, assets/hub-agents-template.md
- Scripts and schemas:
scripts/discover_repos.py,scripts/scan_repo.py,scripts/scan_portfolio.py,scripts/build_artifact_set.py,scripts/build_hub_views.py,scripts/build_knowledge_graph.py,scripts/query_graph.py,scripts/validate_profiles.py,scripts/validate_graph.py,scripts/check_graph_consistency.py,scripts/report_drift.py,scripts/check_hub_freshness.sh, schemas/repo-profile.schema.json, schemas/knowledge-graph.schema.json, schemas/system-edge.schema.json
Fact-Checking
- Known bugs, regressions, framework/compiler/runtime footguns, and version-specific crash or workaround guidance must be verified against current primary web sources before being treated as current fact.
- External source mapping lives in data/sources.json.
- Portfolio summaries must distinguish verified facts from inferred edges.
- If a claim cannot be traced to a manifest, schema, workflow, or other direct evidence, label it accordingly instead of hardening it into a fact.
Architecture Map Template
Domains
- Domain:
Repos: Responsibilities:
Core Flows
- Flow:
Source: Target: Notes:
Shared Platforms
- Datastores:
- Messaging:
- Identity:
- Observability:
Catalog Page Template — Compiled Truth + Timeline
Source: Adapted from garrytan/gbrain at commit adb02b7826a010700efc968b18df8aaf17d8ffa1. License: MIT. Extracted 2026-04-13.Canonical shape for catalog/<repo>.md pages (and, by extension, any compiled-layer page that synthesizes durable facts about a single entity). Every page has exactly two zones separated by a horizontal rule (---):
- Above the line — Compiled Truth: current synthesis. Rewritten whenever new evidence changes the state of play. Read the top, know the state in 30 seconds.
- Below the line — Timeline: append-only evidence log. Every fact in the Compiled Truth section traces back to an entry here. Entries are never rewritten — only new entries are appended.
When to Use This Template
- Catalog pages in a portfolio hub (
catalog/<repo>.md) - Concept notes that synthesize across multiple repos (
concepts/<topic>.md) - Architecture decision records that need both a current-state summary and an audit trail
- Any page where the question "what is true now?" and the question "how did we get here?" have different answers
Template (Repo Catalog Page)
---
type: repo_catalog
repo_id: payments-ledger
title: payments-ledger — Payments Ledger Service
tags: [payments, postgres, kafka, dotnet]
last_compiled: 2026-04-13
last_verified: 2026-04-13
---
## Executive Summary
One paragraph. What this repo does, who owns it, why it exists. If a reader only reads this, they should know whether to keep reading.
## State
- **Runtime**: .NET 9, deployed as a Kubernetes service
- **Storage**: PostgreSQL 16 (primary), Redis (cache)
- **Messaging**: Kafka producer + consumer for `payments.*` topics
- **Owner**: Payments Platform team
- **Status**: Active
## Capabilities
- Double-entry ledger with immutable journal
- Idempotent settlement API
- Event streaming to downstream reconciliation
## Interfaces
- HTTP: `POST /v2/journal/entries`, `GET /v2/accounts/{id}/balance`
- Kafka topics published: `payments.journal.v1`, `payments.settlement.v1`
- Kafka topics consumed: `payments.command.v1`
## Open Threads
Items in flight. Removed from this section when resolved (and the resolution is appended to the Timeline below).
- [ ] Migration from legacy `payments-ledger.v1` endpoints — target Q2
- [ ] Decision pending on partitioning strategy for archive tables
## See Also
- [payments](payments.md) — upstream producer of settlement commands
- [sc.reconciliation](sc.reconciliation.md) — downstream consumer
- [concepts/double-entry-ledger](../concepts/double-entry-ledger.md)
## Evidence Coverage
- Profile: `verified` (scanned 2026-04-13)
- API contract: `verified` (openapi parsed)
- Messaging topology: `subset-verified` (producer confirmed, consumer inference-based)
- Storage: `verified` (from DbContext)
---
## Timeline
- **2026-04-13** — Catalog page regenerated from profile scan. No structural changes; cache layer added to State section. [Source: scripts/build_artifact_set.py, 2026-04-13 09:12 UTC]
- **2026-04-10** — Added Redis cache for account-balance lookups. Resolved open thread "cache layer decision". [Source: PR payments-ledger#412, 2026-04-10 14:30 UTC]
- **2026-03-28** — Upgraded to .NET 9. Runtime field updated above. [Source: Dockerfile diff, payments-ledger@9a3b2c1, 2026-03-28 11:00 UTC]
- **2026-03-15** — Initial profile scan. Repo classified as `service`, language `.NET`, confidence 0.92. [Source: scripts/scan_repo.py, 2026-03-15 08:00 UTC]Rules of the Template
1. Above-line rewrites, below-line appends. When new evidence arrives, update the Compiled Truth section in place — but never edit or delete a Timeline entry. The Timeline is the audit trail; if an earlier entry turned out to be wrong, add a new entry correcting it rather than modifying the old one. 2. Every Compiled Truth claim has a Timeline citation. If a State field exists above the line but no Timeline entry below the line supports it, the claim is unverified — flag it during freshness checks. 3. Open Threads move, not disappear. When an open thread is resolved, remove it from the Open Threads list and append the resolution to the Timeline with the same day's date. The fact that it existed is preserved in the log. 4. Source format is strict: [Source: <who/what>, <date> <time> <tz>]. Who = script name, PR number, human name, tool output, etc. The format lets you grep for unattributed claims. 5. `last_compiled` vs `last_verified`: last_compiled is when the page was last regenerated from profile data. last_verified is when a human or trusted script last confirmed the Compiled Truth still matches reality. They can differ; use last_verified for freshness-check exit gates.
Why Two Zones
- "What's the current state?" is a one-screen read when the synthesis is pre-computed above the line. No one has to scroll through 200 timeline entries and assemble the answer in their head.
- "How did we get here?" is a full audit trail when the evidence log is below the line and never rewritten.
- "Why do I believe this?" traces from a Compiled Truth claim to its supporting Timeline entries via the source citation.
A single append-only log fails the first question. A single rewriteable summary fails the second and third. The two-zone split is how both questions can be cheap to answer at once.
Generation vs Hand-Editing
The Compiled Truth section can be human-edited, but the sustainable pattern is to generate it from the structured profile JSON plus the Timeline. That way:
- Profile scan updates (language, dependencies, manifests) flow automatically into the State fields above the line.
- Human commentary (Assessment, Why it matters, Strategic notes) is the part humans actually spend time on.
- Freshness checks can compare generated Compiled Truth against the last-known snapshot and flag anything that drifted without a Timeline entry explaining why.
Do not let Compiled Truth become an ungrounded prose summary written from memory. If a claim can't be traced to profile JSON, graph edges, or a Timeline entry, it doesn't belong above the line.
Related
- references/hub-design-patterns.md — Why compiled pages should be generated, not hand-written
- references/hub-operations-playbook.md — How to wire this template into the build pipeline
- references/hub-freshness-checking.md — Drift detection that respects the above-line / below-line split
{{ community_id }} — {{ community_name }}
Generated from query_graph.py --communities --resolution {{ resolution }} on {{ generated_at }}.
Snapshot
- Size: {{ size }} nodes
- Modularity contribution: {{ modularity_contribution }}
- Resolution: γ = {{ resolution }}
- Detection seed: {{ seed }}
Composition
| Type | Count | % |
|---|---|---|
| {{ #type_breakdown }} | {{ type }} | {{ count }} |
{{ /type_breakdown }}
| Domain | Count |
|---|---|
| {{ #domain_breakdown }} | {{ domain }} |
{{ /domain_breakdown }}
Anchor nodes
The 5–10 most central nodes by weighted PPR within this community.
{{ #anchor_nodes }}- {{ id }} — {{ label }} ({{ type }}); ppr_score = {{ ppr_score }} {{ /anchor_nodes }}
What this community does
One paragraph describing the shared responsibility, integration boundary, or business capability that ties these nodes together. Generate from anchor-node summaries plus the dominant edge relations between members.
Avoid prose that re-lists every member. Reference the member-ids list at the bottom for full enumeration.
Cross-community ties
Edges that leave this community and where they go.
| External node | Relation | Direction | Weight |
|---|---|---|---|
| {{ #external_edges }} | {{ external_id }} | {{ relation }} | {{ direction }} |
{{ /external_edges }}
Verification status
- Verified: claims grounded in manifests, schemas, or workflow files
- Inferred: claims derived from naming, topology, or graph-edge patterns
- Unverified: claims that need re-checking against source
Members
<details> <summary>Full member list ({{ size }})</summary>
{{ #member_ids }}- {{ id }} {{ /member_ids }}
</details>
Lifecycle
- Generated from:
graphs/knowledge-graph.jsonat version {{ graph_contract_version }} - Source detection run:
reports/community-runs/{{ run_id }}.json - Refresh trigger: regenerate when graph membership churn exceeds 10% or modularity changes by more than 0.05
Coordination Repo Layout
portfolio-hub/
├── AGENTS.md
├── CLAUDE.md
├── catalog/
├── profiles/
├── graphs/
├── reports/
├── docs/
│ ├── architecture/
│ ├── domains/
│ └── migrations/
├── schemas/
├── scripts/
└── sources/Design rule:
- generated artifacts live outside the root instruction files
- schemas and scripts are versioned
- architecture docs link to profiles instead of duplicating them
Embedded repo-local variant:
repo/
├── AGENTS.md
├── docs/
│ ├── product/
│ ├── tech/
│ ├── reports/
│ └── context/
│ ├── profiles/
│ ├── catalog/
│ ├── graphs/
│ └── reports/
└── scripts/Use the embedded layout when the repo already has canonical narrative docs and you need generated context artifacts to stay isolated from those hand-authored files.
Freshness Report Template
Stale Profiles
| Repo | Last Scan | Latest Source Change | Status | Action |
|---|---|---|---|---|
| repo-a | 2026-03-01 | 2026-03-10 | stale | rescan |
Low-Confidence Profiles
| Repo | Confidence | Main Gaps | Action |
|---|---|---|---|
| repo-b | 0.42 | no README, no CI, unclear runtime | manual review |
Hub AGENTS.md Template
Use this template for the master coordination repo, not for source repos.
Purpose
This repo is the canonical context hub for a portfolio of repositories. It stores generated repo profiles, cross-repo architecture views, and refresh workflows.
Canonical Sources
profiles/= machine-readable repo truthcatalog/= human-readable repo summaries generated from profilesgraphs/= system relationshipsreports/= freshness and coverage
Rules
- Do not hand-edit generated files unless the workflow says they are curated.
- Update schemas and generation scripts before changing output formats.
- Keep root instructions navigation-focused; do not paste large inventories here.
- Prefer evidence-backed summaries over inferred prose.
{
"_comment": "Example mapping for a requirements-hub. Copy and adapt for your own portfolio: replace repo_pattern globs and hub_docs paths to match your domain structure.",
"hub_root": ".",
"last_verified_pattern": "last_verified:\\s*(\\d{4}-\\d{2}-\\d{2})",
"mappings": [
{
"repo_pattern": "payments-ledger*",
"hub_docs": [
"overview/data-catalog.md",
"overview/process-catalog.md",
"payments-ledger/**/*.md"
],
"change_weight": "critical"
},
{
"repo_pattern": "payments*",
"hub_docs": [
"incomings/**/*.md",
"overview/process-catalog.md"
],
"change_weight": "critical"
},
{
"repo_pattern": "identity*",
"hub_docs": [
"identity-risk/**/*.md"
],
"change_weight": "critical"
},
{
"repo_pattern": "cards*",
"hub_docs": [
"cards/**/*.md"
],
"change_weight": "critical"
},
{
"repo_pattern": "crypto*",
"hub_docs": [
"crypto/**/*.md"
],
"change_weight": "critical"
},
{
"repo_pattern": "notifications*",
"hub_docs": [
"notifications/**/*.md"
],
"change_weight": "standard"
},
{
"repo_pattern": "web*",
"hub_docs": [
"channels/**/*.md"
],
"change_weight": "standard"
},
{
"repo_pattern": "infra*",
"hub_docs": [
"infrastructure/**/*.md"
],
"change_weight": "standard"
}
]
}
AGENTS.md — <company> Requirements Hub
This file is the portable, always-on instruction layer for any AI agent operating against this hub. Keep it short. It is a map, not an encyclopedia — it routes to the compiled layer, it does not duplicate it.
What this repo is
A cross-repo knowledge hub. It contains compiled markdown, profiles, and graphs about many source repos. It does not contain their source code. Treat the compiled layer as the system of record for cross-repo facts.
Operating rules
1. Read before answering. For any cross-repo question, start from context/docs/repo-index.md and the relevant <domain>/README.md. Do not infer architecture from repo names. 2. Ground every claim. A statement about a repo must trace to a profile (context/graphs/ / <domain>/as-is/) or a cited source. Mark unverified claims as inferred or unverified. 3. Right tool for the question. Direct file read or lexical search for simple lookups; the knowledge graph (context/scripts/README.md) only when relationship structure changes the answer. 4. File durable answers back. A reusable analysis becomes a catalog page, concept note, or context/reports/ entry — not a chat-only reply. Run the placement test in context/docs/documentation-governance.md first. 5. Do not paste inventories here. Repo lists, dependency dumps, and long tables belong in the compiled layer, never in this file. 6. Respect the rule layer. rules/ constraints (compliance, data handling, AI governance, secrets, resilience) are binding. If a task conflicts with a rule, stop and surface the conflict.
Layout
AGENTS.md this file (hot layer)
rules/ binding policy stubs
context/docs/ canonical platform docs
context/templates/ page templates the compiler uses
context/scripts/ thin runners + pointers to the pipeline skills
context/graphs/ repos.json, knowledge-graph.json, context-graph.json
context/overview/ generated cross-cutting maps and catalogs
context/reports/ dated, lifecycle-tagged analyses
<domain>/ one folder per domain (as-is / assessment / initiatives)Runtime layers
AGENTS.md is the portable baseline read by Claude Code, Codex, and Copilot. Add .claude/, .codex/, or .github/ layers only when a tool needs behavior it cannot get from this file.
Replace<company>/<domain>placeholders before use.
Architecture Overview
Template stub. One page that lets a new agent or engineer understand the
whole platform before drilling into a domain. Generated/maintained from
profiles and the knowledge graph — do not hand-write what the compiler
can produce.
Platform in one paragraph
<What the platform does, who it serves, the 3–5 load-bearing systems.>
Domains
<Table of domains → one-line purpose. Keep in sync with domain-map.md.>
| Domain | Purpose | Entry doc |
|---|---|---|
| <domain> | <one line> | <domain>/README.md |
Cross-cutting flows
<The 2–4 flows that cross domains (e.g. onboarding, settlement). Link the generated diagrams in context/overview/.>
Tech baseline
<Languages, runtimes, datastores, messaging — derived from repo profiles, not prose.>
How this page is built
Regenerate from context/graphs/knowledge-graph.json + repo profiles. See context/scripts/README.md.
Documentation Governance
Template stub. The placement gate every new markdown file must pass
before it is created. This is what keeps the compiled layer from
rotting into one-off files.
Placement test
Before creating a new markdown file, answer:
1. Does this belong in an existing catalog page, domain doc, or report? 2. Will it be linked from an index or domain README? 3. Is it generated from structured inputs? If so, is the rebuild command recorded in the file? 4. If it is a point-in-time analysis, does it carry a lifecycle state?
If you cannot answer all four, do not create the file — update the closest canonical doc or keep the result in the task thread.
Layer ownership
| Layer | Files | Who edits |
|---|---|---|
| Hot | AGENTS.md, rules/ | Humans |
| Compiled | context/docs/, <domain>/, catalog pages | LLM, human-reviewed |
| Generated | context/graphs/, context/overview/ | Pipeline scripts only |
| Reports | context/reports/ | LLM, dated + lifecycle-tagged |
Lifecycle states for reports
draft → current → superseded. A superseded report links its successor; it is not deleted (the timeline matters).
Domain Map
Template stub. The authoritative mapping of repo → domain. Every
repo in repo-index.md must appear in exactly one domain here.Domains
<domain>
- Purpose: <one line>
- Repos: <repo-a>, <repo-b>
- Owns: <the data/flows this domain is the system of record for>
- Upstream: <domains/repos it depends on>
- Downstream: <domains/repos that depend on it>
- Folder:
<domain>/
<Repeat per domain. A repo that genuinely spans domains belongs to the one that owns its primary data; note the secondary in Upstream/ Downstream.>
Unassigned
<Repos discovered but not yet classified. Empty is the goal.>
Engineering Standards
Template stub. Non-inferable conventions an agent must follow when it
writes code in the portfolio. Keep only what an agent cannot infer from
reading the repo itself.
Conventions (replace)
- <Language/style baseline per stack — or "match the repo's enforced
style". Phrase as outcomes, not tools that may be absent.>
- <Branching / commit / PR conventions.>
- <Test expectation before a change is considered done.>
- <Architecture boundaries that must not be crossed without approval.>
Anti-patterns
- <Known failure modes specific to this portfolio.>
This is hot-layer policy. The detailed rationale belongs in canonical docs or the relevant domain's as-is/, not here.
Onboarding
Template stub. The path a new engineer or agent takes to become
productive against this portfolio. Link, don't duplicate.
Day-one reading order
1. ../../README.md — what the hub is. 2. ../../AGENTS.md — how to operate. 3. architecture-overview.md — the platform in one page. 4. domain-map.md + repo-index.md — who owns what. 5. The <domain>/README.md for your first task's area.
First task checklist (replace)
- [ ] Cloned the relevant source repos next to this hub.
- [ ] Read the domain's
as-is/for the system you will change. - [ ] Checked blast radius via the knowledge graph.
- [ ] Read
rules/constraints that apply. - [ ] Know who the named approver is for this change.
Where to ask
<Channel / owner per domain.>
Regulatory Context
Template stub. The regulatory frame the portfolio operates under, so an
agent knows why the rules/ constraints exist. Swap every regimereference for your own. Illustrative scaffolding, not legal advice.
Applicable regimes (replace)
| Regime | Applies to | Hub rule |
|---|---|---|
| <e.g. PCI DSS> | <card data flows> | rules/02-data-handling.md |
| <e.g. GDPR/CCPA> | <personal data> | rules/02-data-handling.md |
| <e.g. sector regulator> | <regulated services> | rules/01-compliance.md |
| <e.g. resilience standard> | <important business services> | rules/05-operational-resilience.md |
Important business services
<The flows/repos that, if degraded, cause regulatory or customer harm. Maintained in the relevant <domain>/as-is/. The knowledge graph's blast-radius queries must respect this mapping.>
Source templates
The example regime templates live in dev-context-engineering/assets/ (compliance, data-handling, AI governance). They are labelled examples — replace, do not ship as-is.
Repo Index
Template stub. One line per repo, generated from
context/graphs/repos.json + profiles. This is the agent's fast lookup— keep it short; the detail lives in the per-repo catalog page.
| Repo | Domain | Kind | Stack | Catalog |
|---|---|---|---|---|
| <repo> | <domain> | service\ | library\ | app\ |
Coverage
- Repos discovered: <n>
- Profiled: <n>
- Last scan: <date>
Regenerate with the multi-repo scan pipeline — see context/scripts/README.md. Do not hand-edit rows the scanner owns.
{
"_comment": "Example portfolio registry. discover_repos.py generates the real context/graphs/repos.json. Copy/adapt this shape; replace every placeholder. No org-specific names.",
"generated": "<YYYY-MM-DD>",
"repos_root": "~/repos",
"repos": [
{
"name": "payments",
"path": "~/repos/payments",
"domain": "payments",
"kind": "service",
"primary_language": "<lang>",
"last_scanned": null
},
{
"name": "payments-ledger",
"path": "~/repos/payments-ledger",
"domain": "payments",
"kind": "service",
"primary_language": "<lang>",
"last_scanned": null
},
{
"name": "shared-core",
"path": "~/repos/shared-core",
"domain": "core",
"kind": "library",
"primary_language": "<lang>",
"last_scanned": null
}
]
}
context/overview — generated cross-cutting maps
Index of portfolio-wide artifacts the pipeline generates. These are derived: regenerate them, do not hand-edit. Keep this index current as maps are added.
| Artifact | What it is | Generator |
|---|---|---|
api-catalog.md | Every API contract across repos | ../scripts/generate-api-catalog.sh |
integration-matrix.md | Producer ↔ consumer edge table | dev-context-multi-repo (system-edges) |
dependency-map.md | Cross-repo package/dependency map | dev-context-multi-repo (profiles) |
full-system-diagram.md | Mermaid of the whole portfolio graph | query_graph.py --diagram |
platform-summary.md | The platform in one generated page | knowledge-graph + profiles |
Add a row whenever a new generated map lands. Each artifact must name
its rebuild command in its own header (see
../docs/documentation-governance.md)..gitkeep keeps this folder under version control while empty.
#!/usr/bin/env bash
# audit-agents.sh — report AGENTS.md / CLAUDE.md coverage and staleness
# across the source portfolio. Read-only. Generic.
set -euo pipefail
HUB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
REPOS_ROOT="${1:-$(dirname "$HUB_DIR")}"
STALE_DAYS="${STALE_DAYS:-120}"
now=$(date +%s)
printf '%-28s %-10s %s\n' "REPO" "AGENTS" "AGE(days)"
shopt -s nullglob
for repo in "$REPOS_ROOT"/*/; do
name="$(basename "$repo")"
[ "$repo" = "$HUB_DIR/" ] && continue
[ -d "$repo/.git" ] || continue
f=""
[ -f "$repo/AGENTS.md" ] && f="$repo/AGENTS.md"
[ -z "$f" ] && [ -f "$repo/CLAUDE.md" ] && f="$repo/CLAUDE.md"
if [ -z "$f" ]; then
printf '%-28s %-10s %s\n' "$name" "MISSING" "-"
continue
fi
mtime=$(stat -f %m "$f" 2>/dev/null || stat -c %Y "$f")
age=$(( (now - mtime) / 86400 ))
flag="ok"; [ "$age" -gt "$STALE_DAYS" ] && flag="STALE"
printf '%-28s %-10s %s (%s)\n' "$name" "present" "$age" "$flag"
done
#!/usr/bin/env bash
# generate-api-catalog.sh — collect API contracts across the portfolio
# into a single catalog stub under context/overview/. Read-only scan.
# Generic: extend the FIND patterns for your contract formats.
set -euo pipefail
HUB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
REPOS_ROOT="${1:-$(dirname "$HUB_DIR")}"
OUT="$HUB_DIR/context/overview/api-catalog.md"
{
echo "# API Catalog"
echo
echo "> Generated by context/scripts/generate-api-catalog.sh on $(date -u +%Y-%m-%d)."
echo "> One row per discovered contract. Replace/extend patterns as needed."
echo
echo "| Repo | Contract file | Type |"
echo "|------|---------------|------|"
shopt -s nullglob
for repo in "$REPOS_ROOT"/*/; do
name="$(basename "$repo")"
[ "$repo" = "$HUB_DIR/" ] && continue
[ -d "$repo/.git" ] || continue
find "$repo" \
\( -path '*/node_modules/*' -o -path '*/.git/*' -o -path '*/bin/*' \
-o -path '*/obj/*' -o -path '*/.build/*' \) -prune -o \
\( -iname 'openapi*.y*ml' -o -iname 'swagger*.json' \
-o -iname '*.proto' -o -iname 'asyncapi*.y*ml' \) -print 2>/dev/null \
| while read -r c; do
rel="${c#"$repo"}"
case "$c" in
*.proto) t="gRPC/proto" ;;
*asyncapi*) t="AsyncAPI" ;;
*swagger*|*openapi*) t="OpenAPI" ;;
*) t="unknown" ;;
esac
echo "| $name | $rel | $t |"
done
done
} > "$OUT"
echo "Wrote $OUT"
context/scripts — pipeline runners
This folder holds thin runners. The heavy lifting lives in the three dev-context-* skills. Do not copy the skill scripts here; point at them.
Wiring
Install the three skills (e.g. into .claude/skills/ of this hub, or any path), then set:
export SKILLS=/path/to/skills # contains dev-context-* folders
export CG="$SKILLS/dev-context-code-graph/scripts"
export MR="$SKILLS/dev-context-multi-repo/scripts"
export CE="$SKILLS/dev-context-engineering/scripts"Clone the source repos next to this hub, e.g. ~/repos/<repo>, and this hub at ~/repos/requirements-hub.
Recreate the hub — end to end
# 0. from the hub root
cd ~/repos/requirements-hub
# 1. discover repos → context/graphs/repos.json
python3 "$MR/discover_repos.py" ~/repos --out context/graphs/repos.json
# 2. scan each repo into a normalized profile
python3 "$MR/scan_portfolio.py" --repos context/graphs/repos.json \
--out context/graphs/
# 3. (optional, per repo) single-repo symbol graph for blast radius
python3 "$CG/scan_code_repo.py" ~/repos/<repo> --out /tmp/<repo>.profile.json
python3 "$CG/build_code_graph.py" /tmp/<repo>.profile.json \
--out ~/repos/<repo>/graphs/code-graph.json
# 4. build the cross-repo knowledge graph from profiles
python3 "$MR/build_knowledge_graph.py" --profiles context/graphs/ \
--out context/graphs/knowledge-graph.json
# 5. sanity-query it (ranked central repos)
python3 "$MR/query_graph.py" context/graphs/knowledge-graph.json --rank
# 6. validate the knowledge graph (auto-repair with --fix)
python3 "$MR/validate_graph.py" context/graphs/knowledge-graph.json
# 7. build/validate THIS hub's own context graph (the dev-context-engineering
# scripts are reused as-is — do not reimplement them here)
python3 "$CE/scan_context_artifacts.py" . \
--output context/graphs/context-graph.json
python3 "$CE/validate_context_graph.py" context/graphs/context-graph.json --repo .Expected on a blank hub: validate_context_graph.py flags the rootAGENTS.mdas anorphan(one node, no edges) and exits non-zero. That
is correct for an empty skeleton — the scanner is repo-native and only
the hot-layer file exists yet. The orphan clears once you populate the
hub: as catalog pages, profiles, and .claude/rules/ (if you add aruntime layer) come in and cross-link, edges form. Do not restructure
the hub to silence this on day one.
Then compile catalog pages from the profiles using the templates in ../templates/ and the dev-context-multi-repo workflow. File generated cross-cutting maps into ../overview/ and dated analyses into ../reports/.
Local thin runners
sync-rules.sh— copy the hub'srules/into each source repo (or a
per-repo AGENTS.md pointer) so tools pick them up locally.
audit-agents.sh— findAGENTS.md/CLAUDE.mdacross the portfolio and
flag missing or stale ones.
generate-api-catalog.sh— collect API contracts (OpenAPI/proto/etc.)
across repos into a single catalog stub under ../overview/.
All three are generic and safe to edit for your layout.
#!/usr/bin/env bash
# sync-rules.sh — propagate the hub's rules/ into source repos.
#
# Generic: drops a short AGENTS.md pointer into each repo so any coding
# agent routes back to the hub's rule layer instead of re-deriving policy.
# Edit REPOS_ROOT / HUB_REL for your layout. Idempotent.
set -euo pipefail
HUB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
REPOS_ROOT="${1:-$(dirname "$HUB_DIR")}" # default: sibling of the hub
HUB_REL="${HUB_REL:-../requirements-hub}" # path from a repo back to the hub
shopt -s nullglob
for repo in "$REPOS_ROOT"/*/; do
name="$(basename "$repo")"
[ "$repo" = "$HUB_DIR/" ] && continue
[ -d "$repo/.git" ] || continue
agents="$repo/AGENTS.md"
if [ -f "$agents" ] && grep -q "requirements hub" "$agents" 2>/dev/null; then
echo "ok $name (already points at hub)"
continue
fi
cat > "$agents" <<EOF
# AGENTS.md — $name
Cross-repo context lives in the requirements hub, not here.
- Hub: $HUB_REL
- Binding rules: $HUB_REL/rules/
- This repo's catalog page: $HUB_REL/<domain>/as-is/$name.md
Do not paste cross-repo inventories here. Update the hub catalog page.
EOF
echo "wrote $name/AGENTS.md"
done
echo "Done. Review and commit per repo."
AGENTS.md (per source-repo template)
Drop a short AGENTS.md like this into each source repo so any tool(Claude Code, Codex, Copilot) routes back to this hub instead of
re-deriving cross-repo context. Keep it tiny — it is a pointer.
# AGENTS.md — <repo>
This repo belongs to the **<domain>** domain.
Cross-repo context lives in the requirements hub, not here.
- Hub: <relative-or-URL path to requirements-hub>
- This repo's catalog page: <hub>/<domain>/as-is/<repo>.md
- Domain overview: <hub>/<domain>/README.md
- Binding rules: <hub>/rules/
## Local conventions (non-inferable only)
- <commands / boundaries an agent cannot infer from the code>
Do not paste cross-repo inventories here. Update the hub catalog page.Replace placeholders. The hub is the system of record for anything that spans repos; the per-repo AGENTS.md only carries what is local and non-inferable.
<domain>
Template for a domain folder'sREADME.md. Copyexample-domain/per
real domain, rename, and fill this in.
Purpose
<What this domain is responsible for, in two sentences.>
Repos in this domain
| Repo | Kind | Catalog |
|---|---|---|
| <repo> | service\ | library\ |
Key flows
<The 1–3 flows this domain owns end-to-end. Link diagrams in as-is/diagrams.md.>
Boundaries
- Owns (system of record): <data/flows>
- Depends on: <upstream domains>
- Consumed by: <downstream domains>
Folder map
as-is/— current state: per-repo catalog pages, diagrams,
cross-repo dependencies.
assessment/— gap analysis, migration roadmap, proposals.initiatives/— change RFCs (see../example-domain/README.mdfor the
lifecycle).
<frontend-repo>
Catalog-page template for a frontend / app repo.
- Domain: <domain>
- Kind: web app | mobile app | desktop app
- Stack: <framework / language / build>
- Status: active | legacy
- Confidence: verified | inferred
What it is
<User-facing surface and primary flows.>
Backends consumed
| API / BFF | Owner repo | Contract |
|---|---|---|
| <endpoint> | <repo> | <schema ref> |
Build & runtime
<From project manifests (package.json, project.yml, .xcodeproj, Package.swift) — not README prose. Note excluded generated trees.>
Provenance
- Profile:
context/graphs/<repo>.json· Last scan: <date>
Integration: <system-a> ↔ <system-b>
Catalog-page template for a cross-repo integration. One edge of the
knowledge graph, written up. Generated from system-edge evidence.
- Type: sync API | async event | shared datastore | batch/ETL
- Direction: <a → b>
- Contract: <OpenAPI / schema / topic name + version>
- Confidence: verified | inferred
What flows
<The data/commands crossing this boundary.>
Evidence
| Claim | Source |
|---|---|
| <edge exists> | <manifest/schema/code ref> |
Failure & coupling
<What breaks downstream if the producer changes. Tie to blast-radius query output.>
Provenance
- Edge:
context/graphs/system-edges.json - Rebuild: see
context/scripts/README.md
<library-repo>
Catalog-page template for a shared library / package repo.
- Domain: <domain> (often
core/infra) - Kind: library
- Stack: <language / package ecosystem>
- Status: active | legacy
- Confidence: verified | inferred
What it provides
<The capability it factors out. One paragraph.>
Consumers
<Repos that depend on it — from dependency edges, not guesswork. This list drives blast-radius scoring; keep it evidence-backed.>
| Consumer repo | Version pinned | Evidence |
|---|---|---|
| <repo> | <ver> | <manifest ref> |
Change risk
<Why a breaking change here is high blast radius. Tie to graph articulation-point / impact output.>
Provenance
- Profile:
context/graphs/<repo>.json· Rebuild:context/scripts/README.md
Merge / Pull Request Description Template
Use for changes made against the source portfolio while working from
this hub. Pairs with the AI-disclosure template in
dev-context-engineering/assets/pr-template-ai-disclosure.md.Summary
<What changed and why, in two sentences.>
Scope
- Repo(s): <repo>
- Domain: <domain>
- Blast radius checked: yes/no — <graph query + result>
Rule compliance
- [ ]
rules/01-compliance.md— <n/a or how satisfied> - [ ]
rules/02-data-handling.md - [ ]
rules/04-security-secrets.md— no secrets committed - [ ] Named approver (if required): <name>
AI disclosure
<Which parts were agent-generated; reviewer of record. See the disclosure template.>
Hub updates
- [ ] Catalog page updated:
<domain>/as-is/<repo>.md - [ ] Graph/profile regenerated if structure changed
<service-repo>
Catalog-page template for a service repo. Generated from the repo
profile + graph edges. Keep prose minimal; cite evidence.
- Domain: <domain>
- Kind: service
- Stack: <lang / runtime / framework>
- Status: active | legacy | deprecated
- Owner: <team / named owner>
- Confidence: verified | subset-verified | inferred
Responsibility
<What this service owns. One paragraph.>
Interfaces
| Direction | Interface | Contract | Evidence |
|---|---|---|---|
| in/out | <API/topic/queue> | <schema ref> | <profile/graph ref> |
Dependencies
- Upstream: <repos/services>
- Downstream: <repos/services>
- Datastores: <engines, from manifests not prose>
Operational notes
<Resilience role, known failure modes — only if evidenced.>
Provenance
- Profile:
context/graphs/<repo>.json - Last scan: <date> · Rebuild: see
context/scripts/README.md
example-domain
This is the per-domain template. Copy this whole folder once per real
domain (cp -r example-domain payments), rename it, and fill inREADME.mdfrom../context/templates/domain-readme.md.
Purpose
<What this domain owns, in two sentences.> — replace.
Repos in this domain
| Repo | Kind | Catalog |
|---|---|---|
| <repo> | service\ | library\ |
Folder map
example-domain/
├── README.md this file
├── as-is/ current state: catalog pages, diagrams, deps
├── assessment/ gap analysis, migration roadmap, proposals
└── initiatives/ change RFCs (lifecycle below)- `as-is/` — compiled current-state truth. Per-repo catalog pages
(from ../context/templates/), diagrams.md, cross-repo-dependencies.md. Generated from profiles; human-reviewed.
- `assessment/` —
gap-analysis.md,migration-roadmap.md,
architecture-proposal.md. Point-in-time; carry a lifecycle state.
- `initiatives/` — one folder per change RFC, numbered:
001-<slug>/, 002-<slug>/.
Initiative lifecycle
Each initiative folder carries a status: in its own README and moves through:
draft → proposed → accepted → in-progress → done → graduated- draft — being written, not yet circulated.
- proposed — circulated for review/approval.
- accepted — approved, not yet started.
- in-progress — being implemented in the source repos.
- done — shipped;
as-is/updated to reflect new reality. - graduated — fully absorbed into
as-is/; the initiative folder
moves to initiatives/_graduated/ for history.
Create initiatives/_graduated/ when the first initiative graduates. .gitkeep files keep as-is/, assessment/, and initiatives/ under version control while empty.
<company> Requirements Hub
A single, navigable knowledge hub for a portfolio of repositories. This is a blank scaffold: copy it next to your repos, then let the dev-context-* skills populate it from your actual code.
cp -r hub-scaffold ~/repos/requirements-hubWhat this is
A coordination repo that holds compiled, agent-maintained knowledge about many source repos — without containing their source. It separates:
- hot layer —
AGENTS.md+rules/: short, always-on execution policy. - compiled layer —
context/and the domain folders: profiles, catalog
pages, graphs, and reviewed markdown the LLM maintains.
- raw layer — optional
raw/capture areas (add when you ingest
non-repo evidence such as exported docs or screenshots).
The hub is the system of record for cross-repo knowledge. Each source repo keeps its own single-repo context.
Reading order
1. AGENTS.md — how agents should operate against this hub. 2. context/docs/architecture-overview.md — the platform in one page. 3. context/docs/domain-map.md — domains and which repos belong to each. 4. context/docs/repo-index.md — every repo, one line, with a catalog link. 5. The relevant <domain>/README.md for the area you are working in.
Quick links
| You want… | Go to |
|---|---|
| The platform in one page | context/docs/architecture-overview.md |
| Which repo owns what | context/docs/domain-map.md, context/docs/repo-index.md |
| A specific domain's current state | <domain>/as-is/ |
| Gaps and proposed changes | <domain>/assessment/, <domain>/initiatives/ |
| Cross-repo graph queries | context/graphs/, see context/scripts/README.md |
| Generated reports | context/reports/ |
| Compliance / data / AI rules | rules/ |
How it gets populated
This scaffold ships empty on purpose. Use the three pipeline skills:
- `dev-context-code-graph` — per-repo symbol/import graph
(graphs/code-graph.json) for one repo at a time.
- `dev-context-multi-repo` — discover repos, scan them into profiles,
build the cross-repo knowledge graph, and compile catalog pages here.
- `dev-context-engineering` — single-repo context layers + the
context-graph.json build/validate for this hub itself.
See context/scripts/README.md for the exact command sequence.
Domain folders
Each domain (e.g. payments/, identity/) follows the same shape:
<domain>/
├── README.md # what this domain is, repos in it, key flows
├── as-is/ # current-state docs, diagrams, dependencies
├── assessment/ # gap analysis, migration roadmap, proposals
└── initiatives/ # RFC lifecycle: see example-domain/README.mdexample-domain/ is a working template — copy it per real domain and rename.
Replace every<company>/<domain>placeholder. Nothing here is
specific to any organization.
Rule 01 — Compliance
Stub. Replace with your own regulatory regime. This points at an
example template; it is illustrative scaffolding, not compliance advice.
Binding compliance constraints for any agent changing code or docs in the portfolio. Keep this short and non-inferable — the why and the full checklist live in the referenced template.
Source template
Start from the generic, clearly-labelled example: dev-context-engineering/assets/compliance-fca-emi.md (swap the FCA/EMI regime references for yours: e.g. PSD2, MiCA, SOC 2, HIPAA, PCI DSS, or your sector regulator).
What goes here (replace)
- The 3–6 hard rules an agent must never violate (e.g. "no change to
<regulated-flow> without a named human approver").
- The gate that blocks merge — see
dev-context-engineering/assets/fca-compliance-gate.yml. - Where the evidence/audit trail is recorded.
If a task conflicts with a rule here, stop and surface the conflict.
Rule 02 — Data Handling
Stub. Replace with your own data-protection regime. Illustrative
scaffolding, not legal advice.
Constraints on how agents handle personal, payment, or otherwise sensitive data when reading repos or writing into this hub.
Source template
dev-context-engineering/assets/data-handling-gdpr-pci.md (swap GDPR/PCI DSS for your applicable regime: CCPA, LGPD, HIPAA, etc.).
What goes here (replace)
- Never paste secrets, tokens, PII, or cardholder data into hub markdown,
profiles, graphs, or reports.
- Classification labels the compiled layer must carry
(public / internal / restricted).
- Redaction expectation for raw evidence captured into
raw/. - Data-residency or retention constraints that affect what can be stored.
Rule 03 — AI Governance
Stub. Replace with your own AI-use policy. Illustrative scaffolding.
How AI agents are allowed to operate against this hub and the source portfolio: autonomy boundaries, disclosure, and human accountability.
Source template
dev-context-engineering/assets/ai-agent-governance.md and the disclosure template dev-context-engineering/assets/pr-template-ai-disclosure.md.
What goes here (replace)
- Which actions an agent may take unattended vs. which require a named
human approver.
- AI-contribution disclosure expectation on every change (link the PR
template).
- Model/provider portability constraint (no lock-in to one vendor format).
- Who owns the outcome of agent-generated changes (named accountability).
Rule 04 — Security & Secrets
Stub. Replace with your own security policy. Illustrative scaffolding.
Non-negotiable security constraints for agents touching the portfolio or this hub.
What goes here (replace)
- Never commit secrets, credentials, tokens, private keys, or connection
strings — into source repos or into hub markdown/profiles/graphs.
- Never reproduce a discovered secret into a report or chat answer; record
only its location and that it must be rotated.
- Treat scan output that includes secrets as restricted; redact before it
enters the compiled layer.
- Where to report a discovered exposure (named owner / channel).
Pair with rules/02-data-handling.md for the data-classification labels the compiled layer must carry.
Rule 05 — Operational Resilience
Stub. Replace with your own resilience/continuity regime (e.g.
DORA, SS1/23, or your internal standard). Illustrative scaffolding.
Constraints that keep agent activity from degrading the operational resilience picture this hub is supposed to describe accurately.
Source template
See the resilience portions of dev-context-engineering/assets/compliance-fca-emi.md and your own important-business-services (IBS) register.
What goes here (replace)
- Which repos/flows map to important business services — and that the
mapping in <domain>/as-is/ must stay current.
- Change-impact expectation: cross-repo blast radius must be checked
(via the knowledge graph) before claiming a change is low-risk.
- Freshness obligation: stale resilience claims must be flagged, not
silently trusted (context/scripts/README.md → freshness checks).
NNN — Initiative Title
One-line description of what this initiative improves and why.
>
Date: YYYY-MM-DD · Status: Draft · Target: YYYY-QN
<!-- last_verified: YYYY-MM-DD -->
---
Problem
<!-- 1-3 sentences: what's broken, risky, or inefficient -->
Proposal
<!-- What we plan to do — keep it concise -->
Scope
<!-- Checklist of concrete deliverables -->
- [ ] Deliverable 1
- [ ] Deliverable 2
- [ ] Deliverable 3
Documents
<!-- Add rows as needed — not all are required for every initiative -->
| Document | Purpose |
|---|---|
gap-analysis.md | Gap inventory with severity and evidence |
architecture-proposal.md | Target architecture design |
migration-roadmap.md | Phased migration plan |
| adr-NNN-*.md | Architectural Decision Records |
Decision Log
| ADR | Decision | Status |
|---|
Graduation Criteria
<!-- When is this initiative done? What must be true before graduating to as-is? -->
1. All scope checkboxes complete 2. New architecture documented in as-is/ 3. Old components decommissioned or migration path documented 4. Initiative folder moved to _graduated/
Integration Matrix Template
| Source Repo | Target | Relation | Confidence | Evidence |
|---|---|---|---|---|
| repo-a | postgres | owns_data_in | 0.90 | docker-compose.yml |
Legacy Transition Map
Use this template to map legacy components to target services and sequence the cutover work. Adjust ordering based on dependency constraints, blast radius, validation cost, customer impact, and deadlines rather than forcing one universal rollout rule.
Service Migration Matrix
| Legacy Component | Target Component | Relation | Migration Status | Risk | Suggested Order | Notes |
|---|---|---|---|---|---|---|
| legacy-a | service-a | replaces | not-started | medium | 1 | Standard migration path |
| legacy-b | service-b | splits-from | partial | high | 2 | Requires contract bridge |
Sequencing Factors
- Dependency constraints: which upstream or downstream systems must move first?
- Validation window: how long must old and new paths run in parallel?
- Data migration: which services need storage backfill or dual-write support?
- Contract migration: which packages, schemas, or message topics change?
- External deadlines: which customer, compliance, or provider dates affect cutover order?
Rollout Stages
1. Adapt - refactor or extend the target service to handle the legacy use case. 2. Parallel run - dual-publish, dual-read, or route mirrored traffic where needed. 3. Validate - compare behavior, reconcile mismatches, and confirm success metrics. 4. Cut over - switch consumers and operators to the target path only. 5. Clean up - remove the old path, temporary bridges, and transitional toggles.
Per-Service Notes
| Service | Pre-requisites | Validation Window | Rollback Trigger | Special Handling |
|---|---|---|---|---|
| service-a | None | 7 days | Error-rate regression | Standard runbook |
| service-b | Schema v3 published | 14 days | Reconciliation mismatch | Provider-specific bridge |
Cross-Cutting Concerns
| Concern | Affected Components | Change Needed | Owner |
|---|---|---|---|
| Messaging | service-a, service-b | Topic and consumer cutover | Platform team |
| Data | service-b | Backfill and rollback plan | Data team |
| Contracts | shared package x | Versioned client upgrade | API owners |
Repo Catalog Page Template
Snapshot
- Repo:
- Status:
- Kind:
- Languages:
- Frameworks:
- Architecture:
- Confidence:
Purpose
Short explanation of the repo's role in the portfolio.
Interfaces
- Public interfaces:
- Internal interfaces:
Integrations
- Upstream systems:
- Downstream systems:
Risks
- Known gaps:
- Low-confidence areas:
Evidence
- Path:
- Path:
Scan Backlog Template
| Repo | Priority | Reason | Next Action | Owner |
|---|---|---|---|---|
| repo-a | P1 | unknown architecture | deep scan + manual review | @owner |
{
"metadata": {
"skill": "dev-context-multi-repo",
"title": "Multi-Repo Context Hub",
"description": "Curated sources for AGENTS.md guidance, context engineering, repo instruction surfaces, and documentation quality patterns used by the multi-repo context hub skill.",
"last_updated": "2026-04-25",
"updated": "2026-04-25",
"version": "1.1",
"total_sources": 17,
"verified_on": "2026-04-25"
},
"external_sources": [
{
"name": "garrytan/gbrain",
"url": "https://github.com/garrytan/gbrain",
"commit_sha": "adb02b7826a010700efc968b18df8aaf17d8ffa1",
"license": "MIT",
"extracted_date": "2026-04-13",
"patterns_used": [
"compiled-truth-timeline-template",
"mece-resolver-governance",
"nightly-dream-cycle"
],
"research_pack": "docs/research/2026-04-13-context-engineering-skill-scan.md"
},
{
"name": "MemPalace/mempalace",
"url": "https://github.com/MemPalace/mempalace",
"commit_sha": "6614b9b4e71e67da2236493b036b7bf42ba2d55f",
"license": "MIT",
"extracted_date": "2026-04-13",
"patterns_used": [
"temporal-kg-validity-windows",
"contradiction-detection-categories"
],
"research_pack": "docs/research/2026-04-13-context-engineering-skill-scan.md"
}
],
"categories": {
"context_and_memory": [
{
"name": "AGENTS.md Specification",
"url": "https://agents.md",
"type": "specification",
"description": "Portable repo instruction standard for agents.",
"add_as_web_search": true,
"verified_on": "2026-03-13",
"volatility": "medium"
},
{
"name": "Anthropic: Effective Context Engineering for AI Agents",
"url": "https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents",
"type": "documentation",
"description": "Primary guide for context engineering, context rot, just-in-time context, compaction, note-taking, and multi-agent isolation patterns.",
"add_as_web_search": true,
"verified_on": "2026-04-25",
"volatility": "medium"
},
{
"name": "OpenAI: Harness engineering: leveraging Codex in an agent-first world",
"url": "https://openai.com/index/harness-engineering/",
"type": "documentation",
"description": "Primary OpenAI guidance for repository knowledge as the system of record, short AGENTS.md maps, checked-in plans, and doc-gardening loops.",
"add_as_web_search": true,
"verified_on": "2026-04-25",
"volatility": "high"
},
{
"name": "LangChain: Context engineering in agents",
"url": "https://docs.langchain.com/oss/python/langchain/context-engineering",
"type": "documentation",
"description": "Agent context model covering model context, tool context, lifecycle context, state, and long-term store boundaries.",
"add_as_web_search": true,
"verified_on": "2026-04-25",
"volatility": "high"
},
{
"name": "Claude Code Memory",
"url": "https://code.claude.com/docs/en/memory",
"type": "documentation",
"description": "Official project memory guidance for CLAUDE.md and scoped memory.",
"add_as_web_search": true,
"verified_on": "2026-03-13",
"volatility": "high"
}
],
"platform_context_surfaces": [
{
"name": "OpenAI Codex AGENTS.md Guide",
"url": "https://developers.openai.com/codex/guides/agents-md",
"type": "documentation",
"description": "Current OpenAI guidance for AGENTS.md behavior.",
"add_as_web_search": true,
"verified_on": "2026-03-13",
"volatility": "high"
},
{
"name": "GitHub Copilot Repository Instructions",
"url": "https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions",
"type": "documentation",
"description": "Repository and path-specific instruction surfaces for Copilot.",
"add_as_web_search": true,
"verified_on": "2026-03-13",
"volatility": "high"
},
{
"name": "GitHub Copilot Custom Agents",
"url": "https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/create-custom-agents",
"type": "documentation",
"description": "Custom agent surface for GitHub-native workflows.",
"add_as_web_search": true,
"verified_on": "2026-03-13",
"volatility": "high"
},
{
"name": "VS Code Custom Instructions",
"url": "https://code.visualstudio.com/docs/copilot/customization/custom-instructions",
"type": "documentation",
"description": "Instruction layering and scope behavior in VS Code AI workflows.",
"add_as_web_search": true,
"verified_on": "2026-03-13",
"volatility": "high"
}
],
"knowledge_graph_methodology": [
{
"name": "Understand-Anything: Multi-Agent Knowledge Graph Pipeline",
"url": "https://github.com/Lum1104/Understand-Anything",
"type": "reference_implementation",
"description": "7-phase multi-agent pipeline (Pre-flight → Scan → Analyze → Assemble → Architecture → Tour → Review → Save) using tree-sitter AST and LLM semantic enrichment to build JSON knowledge graphs from codebases. Key adoptable patterns: two-pass analysis, graph-as-artifact, 7-check automated validation, BFS traversal for focused context.",
"add_as_web_search": false,
"verified_on": "2026-03-21",
"volatility": "medium"
},
{
"name": "Microsoft GraphRAG",
"url": "https://microsoft.github.io/graphrag/",
"type": "documentation",
"description": "Official GraphRAG documentation for indexing, query modes, local/global search, and graph-backed corpus retrieval patterns.",
"add_as_web_search": true,
"verified_on": "2026-04-25",
"volatility": "medium"
},
{
"name": "Use Graph When It Needs: Efficiently and Adaptively Integrating Retrieval-Augmented Generation with Graphs",
"url": "https://arxiv.org/abs/2602.03578",
"type": "paper",
"description": "February 2026 paper documenting the graph-overuse trap and adaptive routing between dense retrieval and graph-based retrieval.",
"add_as_web_search": true,
"verified_on": "2026-04-25",
"volatility": "medium"
}
],
"docs_and_quality": [
{
"name": "JSON Schema",
"url": "https://json-schema.org/",
"type": "standard",
"description": "Schema standard for normalized profile contracts.",
"add_as_web_search": true,
"verified_on": "2026-03-13",
"volatility": "low"
},
{
"name": "Diataxis",
"url": "https://diataxis.fr/",
"type": "framework",
"description": "Canonical docs information architecture.",
"add_as_web_search": true,
"verified_on": "2026-03-13",
"volatility": "low"
},
{
"name": "Write the Docs Guide",
"url": "https://www.writethedocs.org/guide/",
"type": "guide",
"description": "Documentation governance and quality patterns.",
"add_as_web_search": true,
"verified_on": "2026-03-13",
"volatility": "low"
}
]
}
}
Example: Mixed Active + Legacy Portfolio
Use this mode when a portfolio contains current systems plus superseded repos.
Expected outputs:
- active vs legacy tagging
- replacement edges
- legacy transition map
- risk report for legacy repos still referenced by active systems
Example: Monorepo Platform
Use this skill when a single repo contains apps/, packages/, and infra/.
Expected outputs:
- one profile for the monorepo root
- optional child-package inventory if the task requires package-level mapping
- architecture summary describing workspace tooling and deployable units
Example: Polyrepo Portfolio
Use this skill when services live in separate repos under one organization.
Expected outputs:
- one
RepoProfileper repo - one edge list for service-to-service and service-to-platform relationships
- one catalog page per repo
- one combined architecture summary
Example: Regulated Enterprise Portfolio
Example shape:
- active product repos
- legacy and superseded repos
- vendor and platform integration repos
- shared libraries and infra repos
- one master coordination repo for generated context
Use this example to validate the universal workflow without encoding client-specific assumptions.
Architecture Inference Rules
Prefer explicit evidence over naming heuristics.
Strong signals:
- API specs imply external or internal service contracts.
- workspace manifests imply multi-package architecture.
services/,apps/,packages/,libs/plus workspace config imply monorepo or package workspace.- queue, topic, or consumer config implies event-driven components.
- migration folders plus HTTP framework usually imply a stateful service.
Weak signals:
- folder names alone
- generic
src/structure - one-off integration mentions in comments
If only weak signals exist, keep architecture_style as unknown or mixed.
Confidence Scoring
Use additive confidence, capped at 1.0.
Suggested weights:
- README with clear purpose:
+0.20 - manifest confirms language/runtime:
+0.20 - CI or deploy config confirms packaging/runtime:
+0.10 - API spec or interface artifact confirms exposure:
+0.15 - explicit dependency/integration config:
+0.15 - ownership signal:
+0.10 - multiple corroborating files for architecture:
+0.10
Penalties:
- no README:
-0.10 - contradictory manifests or docs:
-0.15 - only naming heuristics:
-0.20
Never hide low confidence in prose. Surface it.
Confidence does not transfer sideways across sibling repos, providers, or services. A high-confidence finding for one adapter or repo does not justify a universal statement about the rest of the portfolio. When only a subset was checked, keep the summary labeled subset-verified until full coverage is complete.
Hub Design Patterns
Recommended shape:
- one coordination repo
- one portable root
AGENTS.md - one thin
CLAUDE.mdcompatibility layer when Claude-specific behavior matters - one schema set
- generated profiles
- generated catalog pages
- graph outputs
- freshness and coverage reports
Best-practice organization:
- keep the root instruction file concise and task-routing focused
- put deep operating rules in linked docs or scoped rules
- add nested instruction files only when the nearest-directory override is genuinely needed
- keep platform-specific instruction files additive, not divergent
- derive human-readable catalog pages from structured profile data
- treat raw scans as transient inputs and normalized profiles as canonical generated outputs
Avoid:
- giant root instruction files
- manually curated duplicate summaries
- one-off profile formats per portfolio
- coupling the hub to one AI vendor
Canonical Page Shape
<!-- Source: github.com/garrytan/gbrain@adb02b7826a010700efc968b18df8aaf17d8ffa1 (MIT), extracted 2026-04-13 -->
Catalog and concept pages should default to the compiled-truth + timeline two-zone layout. The top of the page is a regenerable synthesis of current state; the bottom is an append-only evidence log where every claim above the line can be traced to a dated source.
Reference: assets/catalog-compiled-truth-template.md has a full example for a repo catalog page plus the discipline rules (above-line rewrites, below-line appends, strict [Source: …] citation format, resolved Open Threads moving into the Timeline rather than disappearing).
Use this shape because it answers two different questions cheaply at the same time: "what is true now?" reads the top, "how did we get here?" reads the bottom. A single append-only log fails the first question; a single rewriteable summary fails the second.
Hub Freshness Checking
How to detect when a documentation hub is stale relative to its source repositories, and what to do about it.
Table of Contents
- When to Run Freshness Checks
- Quick Start
- How Auto-Mapping Works
- Explicit Mapping Configuration
- Change Detection Categories
When to Run Freshness Checks
| Trigger | Why |
|---|---|
| After pulling/fetching source repos | Catch changes before they accumulate |
| Before planning sessions or architecture reviews | Ensure decisions use current data |
| On a CI/CD schedule (nightly or weekly) | Automated drift detection |
| Before publishing hub updates externally | Verify nothing was missed |
| After a release or deployment wave | Source repos change rapidly during releases |
Quick Start
# Basic: auto-detect baseline from hub's last_verified dates
check_hub_freshness.sh ~/repos/platform ~/repos/platform/requirements-hub
# Explicit date range
check_hub_freshness.sh ~/repos ~/docs-hub --since 2026-03-01
# JSON output for CI pipelines
check_hub_freshness.sh ~/repos ~/docs-hub --json --out freshness.json
# With explicit mapping file
check_hub_freshness.sh ~/repos ~/docs-hub --mapping hub-mapping.json --verboseHow Auto-Mapping Works
Without --mapping, the script greps hub markdown files for repo names. It tries:
1. Exact name — the directory name of the repo (e.g., payments-ledger) 2. Lowercase — case-insensitive match 3. Dot-to-hyphen — payments.ledger also matches payments-ledger
This works well when hub docs naturally reference source repos by name. For hubs that use different terminology, use explicit mapping.
Explicit Mapping Configuration
Create a JSON file following assets/hub-mapping-template.json:
{
"hub_root": ".",
"last_verified_pattern": "last_verified:\\s*(\\d{4}-\\d{2}-\\d{2})",
"mappings": [
{
"repo_pattern": "payments-ledger*",
"hub_docs": ["payments-ledger/README.md", "overview/data-catalog.md"],
"change_weight": "critical"
},
{
"repo_pattern": "payments*",
"hub_docs": ["incomings/**/*.md", "overview/process-catalog.md"],
"change_weight": "critical"
},
{
"repo_pattern": "web*",
"hub_docs": ["channels/web-app.md"],
"change_weight": "standard"
}
]
}repo_pattern supports shell glob matching (fnmatch). change_weight is informational — the script uses commit-level change categories for priority.
Change Detection Categories
The script classifies changed files by pattern:
| Category | Patterns | Priority Impact |
|---|---|---|
| SCHEMA | Migrations, DbContext, MongoRegistry, .sql | P1 — data model changes likely invalidate docs |
| API | Controllers, routes, openapi/swagger, .proto | P1 — interface changes break contract docs |
| MESSAGING | Consumer/Producer/Handler classes, kafka/rabbit configs | P2 — event flow changes need doc updates |
| CONFIG | appsettings, csproj, package.json, docker-compose | P3 — operational changes, lower doc impact |
| INFRA | Dockerfile, k8s YAML, CI/CD configs, terraform | P3 — infrastructure changes |
| OTHER | Everything else | P4 — tests, minor code, internal docs |
Multiple categories can apply to the same repo if different types of files changed.
Interpreting the Report
Markdown Report
The markdown table is sorted by priority. Focus on:
1. P1 repos first — their hub docs likely contain outdated data models, API contracts, or interface descriptions 2. P2 repos — messaging and event flow docs may be inaccurate 3. Affected Hub Docs column — tells you exactly which hub files to re-verify 4. Commit count — high commit counts suggest significant rework, not just patches
JSON Report
The JSON output is designed for CI/CD integration:
# Check if updates needed (exit code 1)
if ! check_hub_freshness.sh ~/repos ~/hub --json --out /tmp/freshness.json; then
# Parse P1 count
p1_count=$(python3 -c "import json; d=json.load(open('/tmp/freshness.json')); print(sum(1 for c in d['changes'] if c['priority']=='P1'))")
if [ "$p1_count" -gt 0 ]; then
echo "ALERT: $p1_count repos have P1 (schema/API) changes affecting the hub"
# Create ticket, send notification, etc.
fi
fiCI/CD Integration
Nightly Check (GitLab CI)
hub-freshness:
stage: verify
schedule:
cron: '0 6 * * *' # 6 AM daily
script:
- ./scripts/check_hub_freshness.sh $REPOS_ROOT $HUB_ROOT --json --out freshness.json
artifacts:
paths: [freshness.json]
when: always
allow_failure: true # Don't block pipelinesGitHub Action
- name: Check hub freshness
run: |
chmod +x scripts/check_hub_freshness.sh
scripts/check_hub_freshness.sh repos/ docs-hub/ --json --out freshness.json || true
if jq -e '.updates_needed' freshness.json; then
echo "::warning::Hub docs need updating — see freshness.json"
fiExtending Change Categories
To add domain-specific patterns, modify the pattern variables at the top of check_hub_freshness.sh:
# Example: add GraphQL schema detection
API_PATTERNS='Controller.*\.cs|/routes/|openapi|swagger|\.proto$|\.graphql$|schema\.gql$'
# Example: add Prisma schema detection
SCHEMA_PATTERNS='Migrations/|DbContext\.cs|MongoRegistry\.cs|\.sql$|InitSchema|schema\.prisma'Relationship to Other Tools
| Tool | Purpose | When to Use |
|---|---|---|
check_hub_freshness.sh | Git-commit-aware hub staleness detection | After repo pulls, before planning |
report_drift.py | Profile-level staleness (mtime-based) | After scanning, to detect stale profiles |
qa-docs-coverage skill | Doc quality gates, freshness metadata, link checking | During doc reviews and PR checks |
check_hub_freshness.sh complements report_drift.py — the former checks source repos against hub docs, the latter checks profiles against source repos. Together they cover the full chain: source → profile → hub doc.
Nightly Compounding Loop (The Dream Cycle)
<!-- Source: github.com/garrytan/gbrain@adb02b7826a010700efc968b18df8aaf17d8ffa1 (MIT), extracted 2026-04-13 -->
Drift detection reports what's stale; the compounding loop repairs it. Running the loop nightly is what turns a hub from a snapshot into an asset that gets more useful over time.
The Four Passes
A nightly job walks the hub and runs four passes, each writing a structured report:
1. Entity sweep — scan all catalog and concept pages for unlinked mentions of other entities in the hub. When a page mentions payments-ledger but has no backlink edge to catalog/payments-ledger.md, add the missing link. Output: reports/entity-sweep-YYYY-MM-DD.json listing added backlinks. 2. Citation audit — flag facts in Compiled Truth sections that lack a Timeline entry with [Source: …] attribution. Do not auto-fix — queue for human review. Output: reports/citation-audit-YYYY-MM-DD.md with flagged claims per page. 3. Memory consolidation — find near-duplicate entries (two Timeline entries within a day describing the same event from slightly different angles; two Open Threads that describe the same in-flight work). Merge duplicates, preserve both source citations. Output: reports/consolidation-YYYY-MM-DD.md. 4. Resolved-thread migration — any Open Thread item closed in the last 24 hours gets moved into the Timeline with its resolution appended as a new entry. This keeps the Open Threads list short and preserves the resolution history.
Recommended Cadence
| Job | Cron | Runtime budget |
|---|---|---|
| Entity sweep | Nightly, 02:00 local | < 5 min for 100 repos |
| Citation audit | Nightly, 02:15 local | < 10 min for 100 repos |
| Memory consolidation | Nightly, 02:30 local | < 15 min for 100 repos |
| Resolved-thread migration | Nightly, 02:45 local | < 2 min for 100 repos |
Run during a quiet window so the compute cost is invisible. Output JSON reports go into reports/ so the next planning session can read them as Level 1 context input.
Why Nightly and Not On-Demand
On-demand feels faster but produces two failure modes: either the loop runs so rarely that drift accumulates, or developers trigger it manually and forget. A cron job running while everyone is asleep compounds quietly — the key insight from the source material is that "the brain compounds overnight," and the compounding only happens if the loop runs without human intervention.
When Not to Run It
- First week of a new hub: the loop is most valuable once there are enough entities and pages for backlinks to matter. For a 5-repo hub with 30 pages, skip the nightly loop and run it weekly instead.
- Hubs under active refactoring: if the directory schema is changing, the entity sweep will thrash. Pause the loop for the duration of the refactor, then run it once to resynchronize.
Contradiction Categories
<!-- Source: github.com/MemPalace/mempalace@6614b9b4e71e67da2236493b036b7bf42ba2d55f (MIT), extracted 2026-04-13 -->
Drift reports are more useful when they classify what kind of drift. Three categories cover most real-world contradictions in a multi-repo knowledge hub:
| Category | Meaning | Example | Signal |
|---|---|---|---|
| Attribution conflict | The wrong entity is credited for a fact | Catalog page says "payments owns the settlement topic" but profile scan shows payments-ledger as the producer | Profile vs hub-page disagreement |
| Temporal error | A date, duration, tenure, or version claim is wrong | Catalog says "runs .NET 8" but manifest scan finds .NET 9 | Fact changed in source; hub not updated |
| Stale information | Once-true fact has been superseded | "Kafka topic payments.journal.v1 is the active producer" when the repo has migrated to v2 | Newer entries exist but older claim was never removed |
Detection Hints
- Attribution conflicts surface from the graph: when an edge in
graphs/knowledge-graph.jsoncontradicts a claim in a catalog page's Compiled Truth section, flag it. This is the highest-confidence category because the graph is built from structured profile data. - Temporal errors surface from manifest diffs: when
profiles/<repo>.jsonhas a newer language/framework version than what the catalog page's State section says, flag the State field and link to the profile entry. - Stale information is the hardest to detect automatically because it requires noticing that a newer claim exists without the older claim being retracted. Default detector: scan Timeline entries for contradictory pairs within the same page, preferring the later entry's claim over the earlier one's.
Reporting Format
Contradictions should feed into reports/drift.json alongside the existing change-category output from check_hub_freshness.sh:
{
"contradictions": [
{
"category": "attribution_conflict",
"page": "catalog/payments.md",
"claim": "owns the settlement topic",
"evidence_against": "graphs/knowledge-graph.json:payments-ledger publishes_to payments.settlement.v1",
"severity": "high",
"suggested_fix": "Update State section to reflect payments-ledger as producer; move old claim to Timeline with correction"
}
]
}Do not auto-fix contradictions. The fix requires judgment about which claim is correct (sometimes the source scan is wrong, not the hub page). Queue them for human review during the next freshness pass.
Hub Operations Playbook
Table of Contents
- Graph Assembly
- Incremental Updates
- Queries And Reports
- Freshness Monitoring
- Resolver-Driven Filing Discipline
- Recommended Hub Layout
- Stable Types
- Validation Checklist
- Workspace Alignment
Graph Assembly
After verification, materialize the portfolio graph.
Mode A, from profiles:
python3 scripts/build_knowledge_graph.py --profiles profiles/Mode B, from an existing hub:
python3 scripts/build_knowledge_graph.py --hub /path/to/hubValidate every build:
python3 scripts/validate_graph.py graphs/knowledge-graph.json \
--output reports/graph-validation.jsonRun consistency checks after validation:
python3 scripts/check_graph_consistency.py \
--hub /path/to/hub \
--graph graphs/knowledge-graph.json \
--output reports/consistency-report.jsonFor ontology, normalization, and parser behavior, use knowledge-graph-patterns.md.
Incremental Updates
Bootstrap or refresh graph state after the first build:
python3 scripts/incremental_update.py graphs/knowledge-graph.json \
--repo-map graphs/repos.json \
--output graphs/knowledge-graph.json \
--report reports/incremental-update.jsongraphs/repos.json can stay portable by using named roots plus repo-relative paths:
{
"roots": {
"main": ["../.."],
"qa": ["../../../platform-qa"],
"legacy": ["../../../platform-legacy"]
},
"repos": {
"payments-ledger": {"root": "main", "path": "payments-ledger"}
}
}Override roots at runtime when local checkout layout differs:
python3 scripts/incremental_update.py graphs/knowledge-graph.json \
--repo-map graphs/repos.json \
--repo-root main=/work/platformQueries And Reports
Generate static graph reports for humans:
python3 scripts/export_graph_report.py graphs/knowledge-graph.json \
--output-dir reports/Common query patterns:
python3 scripts/query_graph.py graphs/knowledge-graph.json --node <id> --hops 1
python3 scripts/query_graph.py graphs/knowledge-graph.json --impact <id> --hops 2
python3 scripts/query_graph.py graphs/knowledge-graph.json --from <id> --to <id>
python3 scripts/query_graph.py graphs/knowledge-graph.json --type repo
python3 scripts/query_graph.py graphs/knowledge-graph.json --search "sumsub kyc" --types provider,process,repo --limit 10
python3 scripts/query_graph.py graphs/knowledge-graph.json --node <id> --hops 1 --format mermaidPrefer static HTML or Markdown reports as the default human-facing output. Treat richer visualization layers as downstream consumers of knowledge-graph.json, not as required outputs of this skill.
Resolver-Driven Filing Discipline
<!-- Source: github.com/garrytan/gbrain@adb02b7826a010700efc968b18df8aaf17d8ffa1 (MIT), extracted 2026-04-13 -->
Hubs rot when filing is ambiguous. The same fact ends up on three pages with three slightly different versions, nobody knows which is current, and agents stop trusting the system. The fix is MECE directories + per-directory resolvers, enforced with a hard rule that no page gets created without walking the resolver first.
Three Founding Rules
1. Every piece of knowledge has exactly one primary home. Directories are mutually exclusive and collectively exhaustive. A repo catalog entry lives in catalog/. A cross-repo concept lives in concepts/. A system map lives in graphs/ (generated) or diagrams/ (hand-authored). MECE applies to directories, not to reality — a complex repo can be referenced from multiple concept pages, but its primary catalog page exists in exactly one place.
2. Every directory has a `README.md` resolver. The resolver answers two questions:
- What goes here — a positive definition with a concrete test. Example: "
catalog/holds one page per repo scanned intoprofiles/. If a topic does not correspond to a single repo, it does not go here." - What does NOT go here — the key distinctions from neighbouring directories. Example: "Architecture patterns that span many repos do not go here; they go in
concepts/. Generated dependency maps do not go here; they go ingraphs/."
3. Top-level `RESOLVER.md` is the decision tree. A numbered walk that answers "where does this new item go?" When two directories seem to fit, explicit disambiguation rules break the tie. When nothing fits, the item goes in inbox/ — which is itself a signal the schema needs to evolve.
The Agent Must Read the Resolver Before Filing
This is not optional. If an agent creates a page without walking RESOLVER.md, the discipline collapses within a month. Wire this into the hub's AGENTS.md as a hard rule, not buried guidance:
# Hub AGENTS.md (excerpt)
## Filing rule (hard)
Before creating ANY new page in this hub:
1. Read `RESOLVER.md` from the hub root.
2. Walk the decision tree for the item type.
3. Read the target directory's `README.md` resolver.
4. If the item does not fit cleanly, place it in `inbox/` and flag for schema review — do NOT force-fit into an existing directory.Resolver Template (Per Directory)
# <directory>/ README (resolver)
## What goes here
<positive test — one sentence, concrete>
Example: A repo catalog page (`catalog/<repo>.md`) belongs here if and only if `profiles/<repo>.json` exists. No profile, no catalog entry.
## What does NOT go here
- <distinction from neighbouring directory 1> → goes in `<neighbour1>/`
- <distinction from neighbouring directory 2> → goes in `<neighbour2>/`
- <distinction from inbox> → goes in `inbox/` if the schema does not cover this case
## Naming convention
<slug rule>
## Required fields
<what every page in this directory must include>
## Related directories
- `<neighbour1>/` — <one-line relationship>
- `<neighbour2>/` — <one-line relationship>Why the Inbox Matters
The inbox/ directory is not a dumping ground — it's a signal channel. When items keep landing there, the schema needs a new directory or a new resolver rule. Treat inbox/ contents as the agenda for the next schema-evolution review (weekly or monthly depending on hub velocity). A well-governed hub aims for a near-empty inbox; a consistently full inbox means the resolver has an unaddressed gap.
Why This Beats "Just Be Consistent"
Agents (and humans under time pressure) cannot "be consistent" across 50-100 directories by willpower. The resolver turns filing into a deterministic walk: read rule, check test, place file. Same input → same destination, every time. That's what makes the hub an artifact that can be rebuilt and audited rather than a pile of human judgment calls that drift with whoever filed things most recently.
Freshness Monitoring
Use check_hub_freshness.sh after source repo pulls, before planning sessions, and on scheduled CI runs:
check_hub_freshness.sh ~/repos ~/docs-hub
check_hub_freshness.sh ~/repos ~/docs-hub --json --out freshness.jsonDefault change categories:
SCHEMAAPIMESSAGINGCONFIGINFRAOTHER
The script ships with .NET/C#-biased patterns. Adapt the regexes for Node, Python, Go, Java, or mixed stacks.
Detailed guidance lives in hub-freshness-checking.md.
Recommended Hub Layout
Preferred shape:
portfolio-hub/
├── AGENTS.md
├── CLAUDE.md
├── README.md
├── context/
│ ├── docs/
│ ├── overview/
│ ├── scripts/
│ ├── templates/
│ ├── graphs/
│ ├── reports/
│ ├── schemas/
│ └── profiles/
├── {domain}/
│ ├── README.md
│ ├── as-is/
│ ├── assessment/
│ └── initiatives/
└── sources/Rules:
- keep the root clean and domain-focused
- keep hub infrastructure under
context/ - keep root
AGENTS.mdshort and navigation-first - keep generated inventories in
profiles/,catalog/,graphs/, andreports/ - use assets/coordination-repo-layout-template.md as the starting layout
Stable Types
Do not invent alternate contracts unless a downstream system requires a transform layer. The canonical schema set is:
schemas/repo-profile.schema.jsonschemas/evidence-ref.schema.jsonschemas/system-edge.schema.jsonschemas/scan-registry-entry.schema.jsonschemas/hub-summary.schema.jsonschemas/knowledge-graph.schema.json
Validation Checklist
- every repo has one
RepoProfile - every nontrivial claim has at least one evidence reference
- portfolio-wide claims are only marked universal when the full scope was verified
- active and legacy repos are not conflated
- storage engine claims are verified from manifests, not docs
graphs/knowledge-graph.jsonhas been built and validatedreports/consistency-report.jsonhas been generated and reviewed- root
AGENTS.mdremains navigation-focused - domain folders include
as-is/,assessment/, andinitiatives/where the assessment model is in use
Workspace Alignment
Domain folder names should match team mental models, usually the IDE workspace prefixes used by the organization.
This is naming alignment only. Do not physically move git repos into domain folders. Use workspace files for IDE grouping and the hub for documentation grouping.
Integration Signal Detection
Look for these signal classes:
- dependency manifests
- environment variable names
- API specs
- webhook handlers
- queue/topic names
- infrastructure config
- vendor SDK package names
- CI/CD deploy steps
- database schema artifacts (see below)
- ORM/data-access registrations (see below)
Database & Storage Signal Detection
Storage engine detection is a common source of errors — the documented storage type often drifts from the actual driver in code. Always verify the actual driver package in dependency manifests rather than trusting documentation headers.
| Signal | File Pattern | What It Reveals |
|---|---|---|
| EF Core DbContext | *DbContext.cs, *Context.cs | SQL tables (DbSet properties), relationships, concurrency tokens |
| MongoDB Registry | *MongoRegistry.cs, *MongoDbRegistry.cs | Collection names, document types, indexes |
| SQL Migrations | db/sql/migrations/*.sql, database/sql/Migrations/*.sql | Table DDL, column types, constraints, migration timeline |
| InitSchema file | *InitSchema*.sql, *Init_Schema*.sql, *initial_ddl*.sql | Clean baseline schema (most valuable single file) |
| Npgsql in .csproj | <PackageReference Include="Npgsql..."> | PostgreSQL (not SQL Server, even if docs say SQL Server) |
| SqlClient in .csproj | <PackageReference Include="*SqlClient*"> | SQL Server confirmed |
| MongoDB driver in .csproj | <PackageReference Include="MongoDB*"> | MongoDB confirmed |
| Connection strings | appsettings*.json, vault references | Database names, servers, connection pooling |
| Entity mapping files | *Map.cs, *Configuration.cs, *EntityTypeConfiguration.cs | Column mappings, FK constraints, indexes |
| Dapper usage | IDbConnectionFactory, raw SQL queries | SQL access without EF Core (Dapper pattern) |
Cross-Service Data Flow Signals
Beyond storage, detect how data flows between services:
| Signal | File Pattern | What It Reveals |
|---|---|---|
| Kafka producers/consumers | *Kafka* projects, IKafkaProducer, KafkaConsumerHandler | Async data flow between services |
| RabbitMQ handlers | *RabbitMq* projects, IBus, IMessageHandler | Event-driven data flow |
| Protobuf contracts | *.proto files, *Contracts* projects | Typed message schemas |
| NuGet API clients | *.PrivateApi.Client packages | Synchronous service-to-service calls |
| ETL/CDC consumers | Acme.Infrastructure.Etl.*, CDC event handlers | Change data capture feeds |
| State machine files | *StateMachine*, Stateless library usage | Entity lifecycle state transitions |
Emit a SystemEdge only when there is at least one concrete artifact or two weaker corroborating signals.
Do not upgrade edge-level evidence into portfolio-wide topology claims unless every sibling edge in scope was checked. Central diagrams, dependency matrices, and messaging summaries must preserve verification scope from the underlying edges and label gaps as subset-verified, inferred, or unverified.
Large Portfolio Strategy
For 100+ repos:
1. Inventory all repos first. 2. Deep-scan only high-priority or low-confidence repos. 3. Use incremental rescans after bootstrap. 4. Separate active, legacy, archived, and vendor repos early. 5. Generate graph outputs from structured data, not markdown parsing. 6. Keep one canonical profile per repo and derive all other views from it. 7. Keep the root hub instructions small and use nearest-scope overrides only where local behavior changes. 8. Split portable instructions from platform-specific layers instead of maintaining multiple drifting root files.
When time is limited:
- full scan metadata for all repos
- manual review for the top 10 highest-risk or most-central repos
Manifest Detection Matrix
| Ecosystem | Primary Files | Useful Secondary Files |
|---|---|---|
| Node.js | package.json | pnpm-lock.yaml, turbo.json, nx.json, tsconfig.json |
| Python | pyproject.toml | requirements.txt, poetry.lock, tox.ini |
| Go | go.mod | go.sum, Makefile |
| Rust | Cargo.toml | Cargo.lock |
| Java | pom.xml | build.gradle, settings.gradle |
| .NET / C# | *.sln, *.csproj | Directory.Build.props, global.json, NuGet.Config, Packages.props |
| Kotlin / JVM | build.gradle.kts | settings.gradle.kts, gradle.properties |
| Containers | Dockerfile | docker-compose.yml, Helm charts |
| Infra | Terraform files | Kubernetes manifests, Helm charts |
Read the smallest set that reveals runtime, dependencies, and build model.
Output Model And Gap Analysis
Table of Contents
- Artifact Root Model
- Core Outputs
- Extended Domain Assessment Model
- Assessment vs Initiatives
- Initiative Lifecycle
- Gap Analysis Categories
Artifact Root Model
Every run should target one artifact root and keep generated outputs grouped consistently.
Recommended shapes:
- coordination repo style:
<artifact-root>/profiles,<artifact-root>/catalog,<artifact-root>/graphs,<artifact-root>/reports - embedded repo-local style:
docs/context/profiles,docs/context/catalog,docs/context/graphs,docs/context/reports
Use scripts/build_artifact_set.py --artifact-root <dir> ... when you want one command to materialize the whole set into a location such as docs/context/.
Core Outputs
Minimum standard outputs:
profiles/<repo>.json
Machine-readable repo profile conforming to schemas/repo-profile.schema.json
catalog/<repo>.md
Canonical human-readable repo profile generated from the JSON profile plus evidence
graphs/system-edges.json
Cross-repo and repo-to-external-system relationships
graphs/knowledge-graph.json
Primary machine-readable graph output for query, blast radius, and report generation
reports/coverage.md
Coverage, completeness, and low-confidence gaps
reports/drift.json
Profiles whose evidence is stale relative to source repos
Common optional outputs:
reports/graph-validation.jsonreports/consistency-report.jsonreports/graph-report.htmlreports/graph-report.mdcatalog/database-schemas.mdcatalog/data-catalog.md
If you need per-repo symbol graphs, keep them as a sibling artifact set via ../../dev-context-code-graph/SKILL.md instead of forcing symbol-level nodes into the portfolio graph.
Extended Domain Assessment Model
For regulated or complex platforms, extend the standard outputs with a per-domain assessment shape:
{domain}/
├── README.md
├── as-is/
│ ├── README.md
│ ├── services/
│ ├── providers/
│ ├── cross-repo-dependencies.md
│ └── diagrams.md
├── assessment/
│ ├── README.md
│ ├── gap-analysis.md
│ ├── architecture-proposal.md
│ ├── migration-roadmap.md
│ └── business-gaps.md
└── initiatives/
├── README.md
├── NNN-short-name/
│ ├── README.md
│ ├── gap-analysis.md
│ ├── adr-*.md
│ └── ...
└── _graduated/Three layers:
| Layer | Folder | Purpose | Lifespan |
|---|---|---|---|
| Current state | as-is/ | What exists today — per-repo docs, architecture, dependencies | Permanent |
| Strategic assessment | assessment/ | Domain-wide gap analysis, architecture proposals, migration roadmap | Long-lived |
| Tactical initiatives | initiatives/ | Scoped improvement work that graduates back into as-is/ | Temporary |
Assessment vs Initiatives
Use assessment/ for domain-wide strategic review that spans all repos and all gap categories.
Use initiatives/ for scoped tactical work on one sub-area, for example:
- incoming payments refactoring
- contract-governance rollout
- provider adapter normalization
- observability hardening
Multiple initiatives can run in parallel inside the same domain.
Use assets/initiative-doc-template.md for new initiatives.
Initiative Lifecycle
Standard lifecycle:
draft → proposed → accepted → in-progress → done → graduated
| Status | Meaning |
|---|---|
draft | Author is writing the proposal |
proposed | Ready for team review |
accepted | Approved, not yet started |
in-progress | Implementation underway |
done | Implementation complete, awaiting graduation |
graduated | Findings merged into as-is/, folder moved to _graduated/ |
Graduation rule:
- findings from a completed initiative must be merged into
as-is/before moving the folder to_graduated/ _graduated/is historical archive only; agents and humans should skip it by default
Gap Analysis Categories
Use the A-O framework when producing regulated or platform-wide gap reviews:
| Cat | Name | Key checks |
|---|---|---|
| A | Messaging & Event Architecture | Broker migration, DLQ patterns, serialization, schema versioning |
| B | Data Consistency | Dual writes, outbox, entity ownership, reconciliation |
| C | Migration & Legacy Decomposition | Legacy dependencies, framework remnants, decomposition roadmap |
| D | Provider Integration Patterns | Shared adapters, webhook validation, deduplication, circuit breakers |
| E | Observability & Operations | OpenTelemetry, tracing, health checks, SLI/SLO |
| F | Security & Compliance | PII in logs, secrets, encryption, OWASP |
| G | Missing Modern Patterns | Outbox, idempotency, caching, CQRS, feature flags |
| H | Regulatory Compliance | ICT risk, incident reporting, resilience testing, exit strategies |
| I | Regulatory Readiness | Upcoming regulation preparation, API evolution, enhanced requirements |
| J | AI Governance | AI in regulated decisions, agent instruction coverage |
| K | Runtime Migration | Framework version currency, migration timeline, breaking changes |
| L | API Contract Governance | OpenAPI coverage, versioning, contract testing, breaking change detection |
| M | Test Coverage & Automation | Test pyramid balance, emulator coverage, performance testing |
| N | Documentation Freshness | AGENTS.md coverage, freshness metadata, template adherence |
| O | Data Residency & Cross-Border | Transfer mechanisms, data classification, residency requirements |
Use severity levels appropriate to the context: BLOCKER, HIGH, MEDIUM, LOW.
Repo Classification Rules
repo_kind defaults:
servicefor deployable backend systems with runtime plus service interfacesappfor user-facing web, mobile, or desktop applicationslibraryfor shared packages or SDKsinfrafor Terraform, Helm, CI/platform reposdatafor analytics, ETL, warehouse, or ML pipelinesdocsfor documentation-only reposmono-rootfor workspace roots coordinating many packagesunknownwhen signals conflict or are insufficient
Native/mobile-specific guidance:
- classify as
appwhen Swift is present and high-signal Apple project files such asproject.yml,.xcodeproj, or.xcworkspaceare present - prefer project-file evidence over generic dependency heuristics for native repos
- ignore generated build trees such as
.build,DerivedData,Pods,Carthage, andSourcePackagesbefore making repo-shape claims
status defaults:
legacywhen repo naming, archived markers, or docs say it is supersededarchivedwhen git hosting or docs explicitly mark it archivedexperimentalfor POCs or labsactiveonly when no legacy/archive signal is present
Repo Discovery Patterns
Use shallow discovery first.
Priority signals:
.git/- root manifests
- CI configuration
- workspace files such as
pnpm-workspace.yaml,nx.json,turbo.json - spec artifacts such as
SPEC.md,specs/,plans/,docs/specs/
Exclude by default:
.archive- build artifacts
- vendored dependencies
- generated clients
Classify before scanning deeply:
- standalone repo
- monorepo root
- package inside workspace
- legacy or archived repo
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/dev-context-multi-repo/schemas/evidence-ref.schema.json",
"title": "EvidenceRef",
"type": "object",
"additionalProperties": false,
"required": ["path", "reason"],
"properties": {
"path": {
"type": "string",
"description": "Repo-relative path to the source file."
},
"snippet": {
"type": "string",
"description": "Short extracted snippet or note."
},
"reason": {
"type": "string",
"description": "Why this file was used as evidence."
},
"last_seen_at": {
"type": "string",
"format": "date-time"
}
}
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/dev-context-multi-repo/schemas/hub-summary.schema.json",
"title": "HubSummary",
"type": "object",
"additionalProperties": false,
"required": ["portfolio_name", "repo_count", "generated_at"],
"properties": {
"portfolio_name": { "type": "string" },
"repo_count": { "type": "integer", "minimum": 0 },
"groups": {
"type": "array",
"items": { "type": "string" }
},
"primary_languages": {
"type": "array",
"items": { "type": "string" }
},
"repo_kinds": {
"type": "array",
"items": { "type": "string" }
},
"key_domains": {
"type": "array",
"items": { "type": "string" }
},
"high_risk_repos": {
"type": "array",
"items": { "type": "string" }
},
"generated_at": {
"type": "string",
"format": "date-time"
}
}
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/dev-context-multi-repo/schemas/knowledge-graph.schema.json",
"title": "KnowledgeGraph",
"type": "object",
"required": ["meta", "nodes", "edges"],
"properties": {
"meta": {
"type": "object",
"required": ["portfolio_name", "generated_at", "version", "node_count", "edge_count", "graph_contract_version", "build_source"],
"properties": {
"portfolio_name": { "type": "string" },
"generated_at": { "type": "string", "format": "date-time" },
"version": { "type": "string" },
"graph_contract_version": { "type": "string" },
"build_source": { "type": "string", "enum": ["profiles", "hub"] },
"node_count": { "type": "integer" },
"edge_count": { "type": "integer" },
"portfolio_metrics": {
"type": "object",
"properties": {
"repo_count": { "type": "integer" },
"service_count": { "type": "integer" },
"provider_count": { "type": "integer" },
"process_count": { "type": "integer" },
"gap_count": { "type": "integer" },
"loc_total": { "type": "integer" }
}
},
"base_commit_shas": {
"type": "object",
"description": "Map of repo_id to git SHA at scan time",
"additionalProperties": { "type": "string" }
},
"validation": {
"type": "object",
"properties": {
"checks_passed": { "type": "integer" },
"checks_total": { "type": "integer" },
"last_validated_at": { "type": "string", "format": "date-time" }
}
}
}
},
"nodes": {
"type": "array",
"items": {
"type": "object",
"required": ["id", "type", "label"],
"properties": {
"id": { "type": "string" },
"type": {
"type": "string",
"enum": ["repo","service","domain","provider","process","artifact","library","package","api_endpoint","queue_topic","database","table","entity","event","config","context_artifact","skill","agent"]
},
"label": { "type": "string" },
"summary": {
"type": "string",
"description": "1-2 sentence plain-English description of this node's purpose. LLM-enrichable."
},
"tags": {
"type": "array",
"items": { "type": "string" },
"description": "3-5 lowercase hyphenated tags (e.g. ['payments', 'kafka-producer', 'csharp']). LLM-enrichable."
},
"importance": {
"type": "number",
"minimum": 0,
"description": "Fan-in count: number of edges whose target is this node. Higher = more critical. Computed by query_graph.py --rank."
},
"parent_id": { "type": "string" },
"domain": { "type": "string" },
"properties": { "type": "object" },
"confidence": { "type": "number", "minimum": 0, "maximum": 1 },
"evidence": { "type": "array", "items": { "type": "object" } },
"first_seen_at": { "type": "string", "format": "date-time" },
"last_verified_at": { "type": "string", "format": "date-time" },
"stale": { "type": "boolean" },
"community_id": {
"type": "string",
"description": "Community label assigned by community detection. Use community_id_<resolution> for multi-resolution runs."
},
"ppr_score": {
"type": "number",
"minimum": 0,
"description": "Personalized PageRank score from the most recent PPR query, when persisted back to the graph."
}
}
}
},
"edges": {
"type": "array",
"items": {
"type": "object",
"required": ["source", "target", "relation", "group"],
"properties": {
"source": { "type": "string" },
"target": { "type": "string" },
"relation": {
"type": "string",
"enum": ["contains","imports","exposes","calls","subscribes_to","publishes_to","reads_from","writes_to","owns_data_in","depends_on","shares_library_with","deploys_with","replaces","extends","related_to","similar_to","contradicts","co_occurs","uses_provider","implements_process","documents","governed_by"]
},
"group": {
"type": "string",
"enum": ["structural","behavioral","data_flow","dependency","semantic"]
},
"weight": {
"type": "number",
"minimum": 0,
"maximum": 1,
"description": "Dependency strength. Convention: contains=1.0, exposes/owns_data_in=0.9, calls/publishes_to/subscribes_to=0.8, imports=0.7, depends_on=0.6, related_to/semantic=0.3. Use weight_static + weight_calibrated when calibration has run."
},
"weight_static": {
"type": "number",
"minimum": 0,
"maximum": 1,
"description": "Original static weight before calibration. Set by calibrate_weights.py."
},
"weight_calibrated": {
"type": "number",
"minimum": 0,
"maximum": 1,
"description": "Calibrated weight from multi-source evidence (manifest, schema, code, prose). Preferred when present."
},
"confidence": { "type": "number", "minimum": 0, "maximum": 1 },
"evidence": { "type": "array", "items": { "type": "object" } },
"notes": { "type": "string" },
"first_seen_at": { "type": "string", "format": "date-time" },
"last_verified_at": { "type": "string", "format": "date-time" },
"stale": { "type": "boolean" },
"edge_id": {
"type": "string",
"description": "Stable edge identifier. Required when supersession or bitemporal fields are used. Convention: <source>__<relation>__<target>."
},
"valid_at": {
"type": "string",
"format": "date-time",
"description": "Bitemporal event-time: when this relationship became true in the world. Optional."
},
"valid_until": {
"type": "string",
"format": "date-time",
"description": "Bitemporal event-time: when this relationship stopped being true. Optional. Omit or null for currently-valid edges."
},
"ingested_at": {
"type": "string",
"format": "date-time",
"description": "Bitemporal transaction-time: when the system learned about this relationship. Optional."
},
"ingested_until": {
"type": "string",
"format": "date-time",
"description": "Bitemporal transaction-time: when this knowledge was superseded inside the system. Optional."
},
"superseded_by": {
"type": "string",
"description": "Edge id that replaced this edge. Use supersession instead of deletion to preserve audit history."
},
"supersedes": {
"type": "string",
"description": "Edge id that this edge replaces. Inverse of superseded_by."
},
"community_id": {
"type": "string",
"description": "Community label assigned by community detection (e.g. Louvain). Multi-resolution detections use community_id_<resolution>."
}
}
}
}
}
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/dev-context-multi-repo/schemas/scan-registry-entry.schema.json",
"title": "ScanRegistryEntry",
"type": "object",
"additionalProperties": false,
"required": ["repo_id", "repo_path", "repo_group", "status"],
"properties": {
"repo_id": { "type": "string" },
"repo_path": { "type": "string" },
"repo_group": { "type": "string" },
"default_branch": { "type": "string" },
"scan_mode": {
"type": "string",
"enum": ["full", "delta", "single-repo"]
},
"exclusions": {
"type": "array",
"items": { "type": "string" }
},
"status": {
"type": "string",
"enum": ["pending", "scanned", "failed", "skipped"]
},
"last_scanned_at": {
"type": "string",
"format": "date-time"
}
}
}
#!/usr/bin/env python3
"""Validate generated repo profiles for required fields."""
from __future__ import annotations
import argparse
import json
from pathlib import Path
REQUIRED_FIELDS = {
"repo_id",
"repo_name",
"repo_path",
"status",
"languages",
"repo_kind",
"architecture_style",
"summary",
"evidence",
"confidence_score",
"last_scanned_at",
}
def validate(profile_path: Path) -> list[str]:
data = json.loads(profile_path.read_text())
missing = sorted(REQUIRED_FIELDS - data.keys())
problems = []
if missing:
problems.append(f"missing fields: {', '.join(missing)}")
if not isinstance(data.get("evidence", []), list):
problems.append("evidence must be a list")
if not isinstance(data.get("confidence_score", 0), (int, float)):
problems.append("confidence_score must be numeric")
return problems
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("profiles_dir", help="Directory containing JSON profiles")
args = parser.parse_args()
profiles_dir = Path(args.profiles_dir)
failures = 0
for path in sorted(profiles_dir.glob("*.json")):
problems = validate(path)
if problems:
failures += 1
print(f"{path.name}: {'; '.join(problems)}")
if failures == 0:
print("All profiles passed basic validation.")
return 1 if failures else 0
if __name__ == "__main__":
raise SystemExit(main())