Harness Knowledge Pipeline
4-phase knowledge extraction, reconciliation, drift detection, and remediation with convergence loop. Keeps the business knowledge graph current and identifies coverage gaps.
When to Use
- When you want a full knowledge health check: extract signals, detect drift, find gaps
- After adding new code, connectors, or diagram files that contain business knowledge
- As a periodic hygiene check to ensure the knowledge graph reflects the codebase
- When
--drift-checkis needed in CI to gate on knowledge freshness - NOT for manually authoring knowledge files (write to
docs/knowledge/directly) - NOT for ingesting a single source (use
ingest_sourceMCP tool directly) - NOT for graph queries or exploration (use
ask_graphorquery_graph)
Process
Prompt the human in plain text — every confirmation, drift acknowledgement, and contradiction resolution in this skill is plain text only. Do not elevate to AskUserQuestion: source labels and finding descriptions routinely exceed its 4-option / 12-char caps, rendering the call as ERR.
- EXTRACT: Run code signal extractors, diagram parsers, BusinessKnowledgeIngestor, and KnowledgeLinker against the project
- RECONCILE: Build pre-extraction snapshot (current graph state) and post-extraction snapshot, then run StructuralDriftDetector
- DETECT: Partition findings by classification (new/stale/drifted/contradicting), generate gap report
- REMEDIATE (only with
--fix): Apply safe remediations, convergence loop up to 5 iterations
Iron Law
Auto-remediate stale findings only. Prompt for drifted and contradicting. Never auto-resolve a contradicting finding — the human must decide which source is authoritative.
Flags
| Flag | Effect |
| ----------------- | ---------------------------------------------------------------- |
| --fix | Enable convergence-based auto-remediation (default: detect-only) |
| --ci | Non-interactive: apply safe fixes only, report everything else |
| --domain <name> | Limit pipeline to specific knowledge domain |
Shared Context Object
All phases read from and write to a shared KnowledgePipelineContext:
interface KnowledgePipelineContext {
extractionSnapshot: KnowledgeSnapshot;
currentSnapshot: KnowledgeSnapshot;
driftResult: DriftResult;
gapReport: GapReport;
remediationsApplied: string[];
iteration: number;
verdict: 'pass' | 'warn' | 'fail';
}
Phase 1: EXTRACT
Extract business knowledge from all available sources into a fresh snapshot.
- Code Signal Extractors: Run
ExtractionRunneragainst the project directory.
- Test description extractor
- Enum/constant extractor
- Validation rule extractor
- API path extractor
- Output goes to
.harness/knowledge/extracted/
- Diagram Parsers: Run
DiagramParser.ingest()for diagram-as-code files.
- Scans for
.mmd,.mermaid,.d2,.puml,.plantumlfiles - Extracts entities and relationships into
business_conceptnodes
- Connector Sync (if configured): Trigger connector sync for Jira, Slack, Confluence.
- Only runs if connectors are configured in
harness.config.json - Skip silently if no connectors
- Solutions Candidates (if
docs/solutions/exists): Run
BusinessKnowledgeIngestor.ingestSolutions("docs/solutions") to consume
knowledge-track post-mortems written by harness-compound.
- Only
docs/solutions/knowledge-track/<category>/*.mdfiles are candidates;
bug-track docs are skipped (they are fix playbooks, not structural facts).
- Each candidate must validate against
SolutionDocFrontmatterSchemafrom
@harness-engineering/core. Invalid frontmatter is logged and skipped.
- Stable
last_updated(older than configurable threshold; default: not gated
in Phase 7) is the promotion criterion for business_concept graph nodes.
- Candidates that pass become
business_conceptnodes in the snapshot.
- Build Fresh Snapshot: Collect all extraction results into a
KnowledgeSnapshot.
- Each entry has:
id,type,contentHash,source,name - Each entry's
domainis resolved via path-based inference (packages/<dir>,apps/<dir>, etc.) unless an explicitmetadata.domainis set; projects can extend or override viaknowledge.domainPatternsandknowledge.domainBlocklistinharness.config.json— see