From harness-claude
> Auto-generate always-current knowledge maps from graph topology. Never stale because it's computed, not authored.
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeThis skill uses the workspace's default tool permissions.
> Auto-generate always-current knowledge maps from graph topology. Never stale because it's computed, not authored.
Analyzes codebase to produce knowledge-graph.json for interactive dashboard exploring architecture, components, and relationships
Traverses docs/ knowledge graph via search and wikilinks to answer project questions on decisions, architecture, conventions. Supports /autology:explore-knowledge overview, neighborhood, path.
Orchestrates parallel subagents to map any codebase, creating docs/CODEBASE_MAP.md with architecture, file roles, dependencies, and navigation. Updates incrementally via git or scans.
Share bugs, ideas, or general feedback.
Auto-generate always-current knowledge maps from graph topology. Never stale because it's computed, not authored.
on_commit to main triggers fireA knowledge graph at .harness/graph/ enables full analysis. If no graph exists,
the skill uses static analysis fallbacks (see Graph Availability section).
Run harness scan to enable graph-enhanced analysis.
Before starting, check if .harness/graph/graph.json exists.
If graph exists: Check staleness — compare .harness/graph/metadata.json
scanTimestamp against git log -1 --format=%ct (latest commit timestamp).
If graph is more than 10 commits behind (git log --oneline <scanTimestamp>..HEAD | wc -l),
run harness scan to refresh before proceeding. (Staleness sensitivity: Medium)
If graph exists and is fresh (or refreshed): Use graph tools as primary strategy.
If no graph exists: Output "Running without graph (run harness scan to
enable full analysis)" and use fallback strategies for all subsequent steps.
When invoked by harness-docs-pipeline, check for a pipeline field in .harness/handoff.json:
pipeline field exists: read DocPipelineContext from it
pipeline.bootstrapped === true, this is a bootstrap invocation — generate full AGENTS.md without confirmation promptDocFix[] to pipeline.fillsAppliedpipeline field does not exist: behave exactly as today (standalone mode)No changes to the skill's interface or output format — the pipeline field is purely additive.
Module hierarchy: Query for module nodes and their contains edges to file nodes.
query_graph(rootNodeIds=[all module nodes], includeTypes=["module", "file"], includeEdges=["contains"])
Entry points: Find file nodes with high out-degree but low in-degree (they initiate dependency chains).
search_similar(query="main entry point index")
Layer structure: Query for layer nodes if defined.
Dependency flow: For each module, trace outbound imports edges to other modules.
get_relationships(nodeId=<module>, direction="outbound", depth=1)
When no graph is available, use directory structure and file analysis:
package.json for main and exports fields. Glob for src/index.* and index.* patterns. These are the entry points.**/*.ts, **/*.tsx, **/*.js, **/*.jsx, etc.).**/*.md, docs/**/*).Fallback completeness: ~50% — no semantic grouping; modules grouped by directory only; no cross-cutting concern detection.
Generate markdown sections following AGENTS.md conventions:
Repository Structure: Module hierarchy with brief descriptions derived from file contents and function names.
Key Entry Points: Files identified as entry points with their purpose (inferred from exports and naming).
Module Dependencies: For each module, list what it depends on and what depends on it. Format as a dependency table.
API Surface: Public exports from each module, grouped by type (functions, classes, types).
Patterns and Conventions: Detected patterns from graph structure (e.g., "all services follow Repository pattern", "tests co-located with source").
Undocumented modules: Use check_docs to find code nodes without documents edges.
Missing descriptions: Modules with no README or doc file.
Stale references: If an existing AGENTS.md exists, compare its file references against the graph to find mentions of files that no longer exist.
## Generated Knowledge Map
### Repository Structure
- **packages/core/** — Core library: context assembly, entropy detection, constraints, feedback
- src/context/ — Token budget, filtering, doc coverage, knowledge map validation
- src/entropy/ — Drift detection, dead code analysis, pattern violations
- src/constraints/ — Layer validation, circular dependency detection, boundaries
- src/feedback/ — Self-review, peer review, diff analysis
- **packages/graph/** — Knowledge graph: store, query, ingest, search
- src/store/ — LokiJS-backed graph store, vector store, serialization
- src/query/ — ContextQL traversal, projection
- src/ingest/ — Code, git, knowledge, connector ingestion
- src/search/ — FusionLayer hybrid search
### Entry Points
1. packages/core/src/index.ts — Core library barrel export
2. packages/graph/src/index.ts — Graph library barrel export
3. packages/cli/src/index.ts — CLI entry point (Commander.js)
4. packages/mcp-server/src/server.ts — MCP server registration
### Coverage Gaps
- 3 modules have no documentation
- 5 files have no test coverage
After generating documentation, refresh the graph so new documents edges reflect the updated docs:
harness scan [path]
This ensures subsequent graph queries (impact analysis, drift detection) include the newly generated documentation.
harness scan — Recommended before this skill for full graph-enhanced analysis. If graph is missing, skill uses directory structure fallbacks.harness validate — Run after acting on findings to verify project health.query_graph, get_relationships, and check_docs MCP tools.| Rationalization | Why It Is Wrong |
|---|---|
| "The graph is a few commits behind, but it is close enough for knowledge mapping" | If the graph is more than 10 commits behind, run harness scan before proceeding. A stale graph produces a knowledge map with missing modules. |
| "No graph exists, so this skill cannot produce useful output" | The fallback strategy is explicit: use directory structure and file analysis. Fallback completeness is ~50%, significantly better than nothing. |
| "The existing AGENTS.md is outdated, so I will overwrite it with the generated version" | Never overwrite without confirmation. Existing AGENTS.md may contain carefully authored context the graph cannot infer. |
| "The module descriptions I inferred from function names are accurate enough" | Inferred descriptions are starting points. Phase 3 (AUDIT) exists to identify coverage gaps. Name-based inference misses purpose, constraints, and relationships. |
Input: No AGENTS.md exists, graph is current after harness scan
1. SURVEY — query_graph for module hierarchy: 4 packages found
search_similar for entry points: 4 identified
get_relationships for dependency flow per module
2. GENERATE — Built 5 sections: structure, entry points,
dependencies, API surface, patterns
3. AUDIT — check_docs found 3 undocumented modules,
5 files with no test coverage
4. OUTPUT — Wrote AGENTS.md to project root (new file)
Output:
AGENTS.md generated (142 lines)
Coverage gaps: 3 undocumented modules, 5 untested files
No stale references (fresh generation)