Knowledge Graph
GitKB extracts relationships from Markdown and frontmatter into a queryable graph. Committing a document updates its canonical content and derived relationships. The daemon can also preview relationships from valid workspace edits before commit.
Relationships
| Relationship | How to write it | Direction |
|---|---|---|
references | [[specs/auth]] in the body, or references: [specs/auth] | This document → target |
parent_of | parent: tasks/auth-epic | Parent → this document |
implements | implements: [specs/auth] | This document → spec |
blocks | blocked_by: [tasks/session-store] | Blocker → this document |
depends_on | depends_on: [tasks/session-store] | This document → dependency |
references_code | [[code:src/auth.rs::login]] | Document → code reference |
references_commit | [[commit:core@abc1234]] | Document → source Git commit reference |
blocks is derived from the graph. Write blocked_by on the blocked document to create a blocking edge. A sentence saying that a task “resolves” an incident creates a references edge when it contains a wikilink; the wording does not create a separate resolves relationship.
For example:
This task implements [[specs/auth]].
See [[code:src/auth.rs::login]] for the entrypoint.
The source change is recorded in [[commit:core@abc1234]].The repository name in a commit reference corresponds to the configured repository registry. Code references support file and symbol targets; use complete IDs from code-intelligence JSON when resolving an ambiguous symbol.
Querying
# Both directions, two levels deep
git-kb graph tasks/auth-flow --direction both --depth 2 --json
# Who points to this document?
git-kb graph specs/auth --direction in --json
# What does this document point to?
git-kb graph tasks/auth-flow --direction out --json
# Restrict edge types or combine roots
git-kb graph tasks/auth-flow --rel-type depends_on --json
git-kb graph tasks/auth-flow specs/auth --jsonSupported graph formats are tree, json, dot, mermaid-gantt, and plan. Use JSON for scripts and agents. --critical-path identifies the longest dependency chain; --format plan returns a dependency-ordered execution plan.
Containers and ordering
Container membership is separate from semantic relationships. Use link, unlink, and reorder for ordered collections of documents:
git-kb link tasks/auth-flow --to specs/authReview pending changes and commit the affected document. See CLI Reference for code links, commit links, and ordering options.
Previewing changes
git-kb status --json
git-kb diffstatus reports pending workspace state and graph changes; diff shows the content and metadata edits behind them. Invalid workspace documents can produce validation events instead of a graph projection. Correct the frontmatter or Markdown and review again before committing.
External references and apps
The external_refs frontmatter field records references to external systems. Enabled local apps can add descriptors that derive external references from document data. These are query projections; app installation and configuration are local to the machine.
git-kb app list --json
git-kb external-refs --helpNext steps
- Documents — Workspace editing and canonical history
- Code Intelligence — Call graphs, impact, and document references
- Agent Workflows — Load and traverse task context