Knowledge Engineering
Everything is context. Software engineering becomes knowledge engineering.
Knowledge engineering is the discipline of building systems where knowledge is structured, versioned, connected to code and queryable by both people and agents, so that what a team knows compounds over time.
For agents to build working software, a team engineers the knowledge system they work from: the specifications, invariants, decisions, research and tasks that define what correct means. Code and working software emerge from that knowledge base. GitKB is the set of tools for engineering it.
Knowledge first, software follows
Each layer narrows the one below it. Research informs decisions, decisions shape specifications and their invariants, specifications define tasks, and agents turn tasks into code. Tests, reviews and incidents return as evidence that changes the next decision.
flowchart TD
R[Research] --> D[Decisions]
D --> S[Specifications and invariants]
S --> T[Tasks]
T --> A[Agents write the code]
A --> E[Tests, reviews and incidents]
E -->|evidence| DThe document is the plan. A task says what to do and links to the specification it implements; the specification says what must hold; the decision says why. An agent that reads the task through those links has the intent behind the code, not only the code.
What a knowledge base holds
| Knowledge | What it captures | How GitKB stores it |
|---|---|---|
| Specifications | Behavior the system provides and the contracts it keeps | spec documents |
| Invariants | Properties every implementation and migration preserves | Sections of the specification they belong to |
| Decisions | What was chosen, the alternatives and why | decision documents |
| Research | Findings, measurements and sources behind a decision | note documents |
| Tasks | Executable work, acceptance criteria and progress | task documents |
| Incidents | What failed, why and what changed | incident documents |
Every document is Markdown with YAML frontmatter, stored in .kb/ beside your code. See Documents for types, statuses and fields.
The practices GitKB supports
| Practice | Mechanism |
|---|---|
| Structure | Typed documents with status, priority, tags and custom fields |
| Connection | Graph edges such as implements, depends_on and blocked_by, plus wikilinks to documents, code symbols and commits (Knowledge Graph) |
| Grounding in code | A code intelligence index of symbols, callers and callees, linked from documents with [[code:path::symbol]] (Code Intelligence) |
| Versioning | A per-document commit history with SHA-256 hashes, separate from your repository’s Git history |
| Sharing | Push and pull commits, and check out only the documents you need |
| Agent access | An MCP server and the git-kb CLI; kb_smart_context assembles a task’s linked documents and code within a token budget |
A working loop
A specification states what must hold, a task implements it, and the agent starts from both:
---
title: Make the login handler async
type: task
implements: [specs/session-auth]
---
Keep the refresh behind the lock: [[decisions/jwt-rotation]].
The entrypoint is [[code:src/auth.rs::login_handler]].# Inspect what the task connects to
git-kb graph tasks/login-async --direction both --depth 2 --json
# See what an edit to the entrypoint reaches
git-kb code callers 'src/auth.rs::login_handler' --json
# Record progress and share it
git-kb commit -m "Login handler async; refresh stays behind the lock" tasks/login-async
git-kb push originThe next session, in any agent, reads the same task, its specification and its decisions, and continues from the recorded progress.
Next steps
- From Context Engineering to Knowledge Engineering: the argument behind the practice.
- Documents: types, frontmatter and lifecycle.
- Knowledge Graph: relationships and queries.
- Agent workflows: how agents read and update the knowledge base.