# GitKB — Full Documentation
Source: https://gitkb.com/llms.txt
Full content: https://gitkb.com/llms-full.txt
GitKB is a knowledge base CLI and MCP tool for software engineering teams
and AI agents. This file contains all documentation pages concatenated in
navigation order, including agent harness setup, skills, MCP tools, and
the CLI reference generated from src/lib/docs/cli-commands.ts.
────────────────────────────────────────────────────────────────────────
## Introduction
URL: https://gitkb.com/docs/
Section: Getting Started
---
title: Introduction
description: Learn how to use GitKB — a git-like distributed knowledge base with sparse sync and checkout semantics.
---
# GitKB Documentation
GitKB is a local-first knowledge graph for Markdown documents and source code. Create a document, check it out, edit it, commit the change, and sync the documents you need with a remote.
Document history is tracked per document. A commit can change several documents, and each change points to the prior commit for that document. You can hold a small subset of a knowledge base without cloning every document or its unrelated history.
## How it fits together
```mermaid
flowchart LR
People["You and your agents"] --> Tools["CLI, Desktop and MCP"]
Tools --> Daemon["Local GitKB daemon"]
Daemon --> KB["Your knowledge base"]
Daemon --> Intel["Code intelligence"]
Code["Your code"] --> Intel
KB <--> Remote["Your team's remote"]
```
- **Documents:** specs, tasks, decisions and the rest are Markdown files with a little frontmatter, linked to each other and to your code.
- **History:** every change is a commit, so you can see who changed what, when and why, and return to any version.
- **Agents:** any agent that can use a CLI or MCP reads and writes the same knowledge you do.
- **Daemon:** a local GitKB daemon keeps your knowledge base and code index current, and serves both to the CLI, Desktop and MCP. See [Daemon](/docs/core-concepts/daemon/).
- **Code intelligence:** GitKB indexes your code, so you and your agents can see callers, call paths and the reach of a change.
- **Sharing:** push to a remote when your team needs it, pull the slices you select, and check out only the documents you need.
## Local work and collaboration
Everything works locally and offline, with no account or server. When your team needs it, push to a remote, on GitKB.com or your own infrastructure, pull the slices you select, and check out only what you need. Knowledge keeps its own history, separate from your code's Git history, so document edits never clutter code diffs.
Optional local embeddings add semantic search across documents and code.
## Quick overview
### Documents
Everything in GitKB is a **document** with YAML frontmatter and Markdown content:
```yaml
---
slug: tasks/my-feature
title: "Add user authentication"
type: task
status: active
tags: [feature, auth]
---
## Overview
What this task accomplishes and why it exists.
## Acceptance Criteria
- [ ] JWT-based auth flow
- [ ] Session management
- [ ] Tests passing
```
Documents have types (`task`, `spec`, `incident`, `note`, `context`), statuses, tags, and relationships to other documents via `[[wikilinks]]`.
### The knowledge graph
Documents link to each other through wikilinks, frontmatter references, and code symbols — forming a **knowledge graph** you can query:
```bash
git-kb graph tasks/my-feature --direction both
```
### MCP integration
Connect GitKB to your editor and AI assistants gain full access:
```json
{
"mcpServers": {
"gitkb": {
"command": "git-kb",
"args": ["mcp"]
}
}
}
```
The first store-backed tool call connects to the daemon and starts it if needed. MCP initialization and tool discovery can complete before the daemon starts.
## Next steps
────────────────────────────────────────────────────────────────────────
## Installation
URL: https://gitkb.com/docs/getting-started/installation/
Section: Getting Started
---
title: Installation
description: Install GitKB and initialize your first knowledge base.
---
# Installation
## Install the GitKB CLI
GitKB is distributed as a single binary. Install it with your preferred method:
### Homebrew (macOS)
```bash
brew install gitkb/tap/gitkb
```
### Install script (macOS / Linux)
```bash
curl -fsSL https://get.gitkb.com/install.sh | bash
```
### mise
Install release builds from GitHub via [mise](https://mise.jdx.dev/):
```bash
mise use github:gitkb/gitkb-releases
```
Run in your project to record the tool in mise config, or configure globally per [mise docs](https://mise.jdx.dev/).
### Verify installation
```bash
git-kb --version
```
If you use GitKB Desktop with mise, ensure your shell `PATH` includes mise shims, or choose the `git-kb` binary in Desktop Settings when the app is launched from Finder.
## Initialize a knowledge base
Navigate to your project root and initialize:
```bash
cd your-project
git-kb init
```
This creates a `.kb/` directory in your project root with the knowledge base and its configuration.
## What's in `.kb/`?
```
.kb/
├── .gitignore # Commits only the shared files below
├── config.toml # KB configuration
├── AGENTS.md # Agent guide for this KB
├── rules/ # Shared agent rules (when installed)
├── skills/ # Shared agent skills (when installed)
└── workspaces/ # Pending edits, isolated by Git worktree
└── main/ # Default checkout workspace
```
GitKB keeps your committed documents and history in its own local store under `.kb/`, along with indexes it can rebuild. Edit documents through the checkout workspace, then use `git-kb commit` to record the changes; leave every other file under `.kb/` to GitKB.
The generated `.kb/.gitignore` commits only `.gitignore`, `config.toml`, `AGENTS.md`, `rules/` and `skills/` to your Git repository. The store, indexes, locks and workspaces stay local: teammates fetch documents from a remote or rebuild them. Add your own lines at the end of `.kb/.gitignore`; a later line wins.
Ask GitKB for the current workspace rather than assuming a path, especially in a linked Git worktree:
```bash
git-kb workspace resolve --json
```
## Optional: colorized Markdown output
GitKB can pipe `git-kb show` output through [glow](https://github.com/charmbracelet/glow) for syntax-highlighted, styled Markdown in your terminal.
Install glow via Homebrew or [see glow's install docs](https://github.com/charmbracelet/glow#installation) for other methods:
```bash
brew install glow
```
Then add to `.kb/config.toml`:
```toml
[pager]
markdown = "glow -p -w 0"
```
See [Configuration](/docs/reference/configuration/) for details.
## Start using code intelligence immediately
Code intelligence works on any Git repo right after installation — no `git-kb init` required:
```bash
cd your-project
git-kb code index
git-kb code symbols authenticate --json
git-kb code callers authenticate --json
```
See [Code Intelligence](/docs/core-concepts/code-intelligence/) for the full command reference, or continue to the [Quick Start](/docs/getting-started/quick-start/) for the full setup.
## Next steps
- [Quick Start](/docs/getting-started/quick-start/) — Create and sync project documents
- [Code Intelligence](/docs/core-concepts/code-intelligence/) — Start with code intelligence alone
────────────────────────────────────────────────────────────────────────
## Quick Start
URL: https://gitkb.com/docs/getting-started/quick-start/
Section: Getting Started
---
title: Quick Start
description: Index a Git repository, connect an agent, and create your first committed document.
---
# Quick Start
## Explore a codebase
After [installing GitKB](/docs/getting-started/installation/), index a Git repository. Local use is free and needs no account or server. Code commands can use a local index in Git's private metadata without a full knowledge base:
```bash
cd your-project
git-kb code index --json
git-kb code symbols authenticate --json
git-kb code callers authenticate --json
git-kb code impact src/auth.ts --json
```
Replace the symbol and file names with ones from your repository. Callers, impact analysis, and dead-code reports describe the indexed graph. Review their evidence before changing code; a symbol with no indexed callers can still be used at runtime.
## Initialize a knowledge base
Create a KB for tasks, specs, notes, and project context:
```bash
git-kb init
git-kb init claude # or: git-kb init codex
```
The harness integration installs GitKB workflows and project instructions. Claude's integration also registers the MCP server. For Codex and other clients, follow [MCP Setup](/docs/getting-started/mcp-setup/) to connect the tools.
Ask your agent to read the project instructions and help capture the project's purpose, architecture, decisions, and current work. The scaffold supplies guidance; the agent and your review determine what goes into those documents.
## Create and commit a task
GitKB documents are Markdown with YAML frontmatter. Creating a document writes a pending workspace file:
```bash
git-kb create task --slug tasks/auth-refactor --title "Refactor auth module" --json
git-kb workspace path tasks/auth-refactor --json
git-kb status --json
```
Edit the path returned by `workspace path` to add the task's scope and acceptance criteria. Check the diff, then commit only that document:
```bash
git-kb diff
git-kb commit -m "Add auth refactor task" tasks/auth-refactor --json
git-kb show tasks/auth-refactor --json
```
Checkout workspaces live under `.kb/workspaces//`. The main workspace is usually `.kb/workspaces/main/`; linked Git worktrees have their own identities.
To edit an existing document:
```bash
git-kb checkout tasks/auth-refactor
git-kb workspace path tasks/auth-refactor --json
# Edit the returned file, then inspect and commit it.
git-kb diff
git-kb commit -m "Update acceptance criteria" tasks/auth-refactor --json
```
`create`, `set`, and assignment commands leave pending edits. A KB commit records them in the canonical file store and updates the derived indexes.
## Find work and context
```bash
git-kb list --type task --status active --json
git-kb board --json
git-kb search "authentication" --json
git-kb graph tasks/auth-refactor --json
git-kb context tasks/auth-refactor --code-refs --token-budget 4000
```
Use `--json` for agents and scripts whenever the command supports it. Human-readable tables can shorten slugs and IDs.
## Share selected documents
Configure a remote using the URL supplied by your hosted or self-hosted KB, then authenticate if it requires sign-in:
```bash
git-kb remote add origin https://gitkb.com/api/v1/sync/your-org/your-kb
git-kb login origin
git-kb push origin tasks/auth-refactor
git-kb pull origin context/ --json
```
Push and pull take an explicit remote. Pulling adds selected documents to your local store; checkout makes local documents editable. See [Team Collaboration](/docs/guides/team-collaboration/) for sparse sync and conflict recovery.
## Next steps
- [Documents](/docs/core-concepts/documents/) — Types, frontmatter, and workspace edits
- [MCP Setup](/docs/getting-started/mcp-setup/) — Connect your agent's tools
- [Code Intelligence](/docs/core-concepts/code-intelligence/) — Inspect the code graph
- [Agent Workflows](/docs/guides/agent-workflows/) — Keep context and evidence between sessions
────────────────────────────────────────────────────────────────────────
## MCP Setup
URL: https://gitkb.com/docs/getting-started/mcp-setup/
Section: Getting Started
---
title: MCP Setup
description: Connect GitKB's local MCP server to your agent client and verify the intended knowledge base.
---
# MCP Setup
GitKB exposes **134 MCP tools** (`110` core via `git-kb mcp`, `21` code intelligence via `git-kb code mcp`, and `3` semantic search via `git-kb semantic mcp`) for documents, workspaces, sync, code intelligence, and project context. The [MCP Tools Reference](/docs/reference/mcp-tools/) lists them by category.
## How it works
Your client launches `git-kb mcp` as a local stdio server. MCP initialization and tool discovery can complete before the daemon is running. A tool operation connects to the per-KB daemon and starts it when needed.
Run the client in your project directory so GitKB discovers its `.kb/`. If the client launches servers elsewhere, configure `GITKB_ROOT` with the absolute project path.
## Claude Code
The [Claude scaffold](/docs/getting-started/claude-code/) writes the root `.mcp.json` for you:
```bash
git-kb init claude
```
For manual setup, add the server to `.mcp.json`:
```json
{
"mcpServers": {
"gitkb": {
"command": "git-kb",
"args": ["mcp"]
}
}
}
```
## Codex
Register the local server:
```bash
codex mcp add gitkb -- git-kb mcp
codex mcp list
```
You can also configure it in Codex's `config.toml`:
```toml
[mcp_servers.gitkb]
command = "git-kb"
args = ["mcp"]
[mcp_servers.gitkb.env]
GITKB_ROOT = "/absolute/path/to/your-project"
```
The explicit root is useful when the server's working directory differs from the project. Codex supports user and trusted project configuration; see the [official OpenAI MCP documentation](https://developers.openai.com/codex/mcp).
For GitKB workflow skills and project instructions, also run `git-kb init codex`. The optional hook bundle has its own MCP entry; see [Codex](/docs/getting-started/codex/) before combining installation methods.
## Other clients
The same stdio command works with MCP clients that can launch local processes:
| Client | GitKB scaffold | MCP configuration |
| ----------------------- | ---------------------- | -------------------------------------------------------------------------- |
| Cursor | `git-kb init cursor` | `.cursor/mcp.json` |
| Windsurf | `git-kb init windsurf` | Use the global MCP settings described by the scaffold |
| OpenCode | `git-kb init opencode` | `opencode.json` |
| oh-my-pi | `git-kb init oh-my-pi` | `.omp/mcp.json` |
| Grok Build | `git-kb init grok` | `.grok/config.toml` |
| Cline and other clients | Manual | Add command `git-kb` with arguments `["mcp"]` in the client's MCP settings |
Use `git-kb init --help` for its options, and `--dry-run` to preview generated files. Harnesses differ in whether they use project or global MCP configuration; the [harness reference](/docs/reference/agent-harnesses/) covers the supported integrations.
For JSON clients that accept the `mcpServers` format, the server entry can include an explicit root:
```json
{
"mcpServers": {
"gitkb": {
"command": "git-kb",
"args": ["mcp"],
"env": {
"GITKB_ROOT": "/absolute/path/to/your-project"
}
}
}
}
```
## Verify an operation
Restart or reconnect the client after changing configuration. Ask:
> "Use GitKB to list the documents in this project's knowledge base."
The assistant should call `kb_list`. Confirm that the returned documents belong to the intended project. Tool discovery alone verifies the stdio connection; a successful KB operation also exercises the daemon path.
MCP writes follow the workspace-first model. Creating or updating a document normally leaves pending edits; use `kb_status`, `kb_diff`, and a scoped `kb_commit` to record them. Some tools offer an explicit `commit` option; inspect their schemas for that behavior.
## Troubleshooting
| Problem | Check |
| --------------------------------------- | ------------------------------------------------------------------------------- |
| Server command not found | Make `git-kb` available to the client's process, or configure its absolute path |
| Tools do not appear | Check the client's MCP status and reconnect after editing configuration |
| Tools list works but an operation fails | Run `git-kb daemon status` and `git-kb doctor --json` in the project |
| Wrong KB loaded | Set `GITKB_ROOT` in the server environment and reconnect |
| Remote sync operation fails | Check authentication and run `git-kb sync status origin --json` |
## Next steps
- [MCP Tools Reference](/docs/reference/mcp-tools/) — Tool inventory and parameters
- [Claude Code](/docs/getting-started/claude-code/) — Rules, skills, and hooks
- [Codex](/docs/getting-started/codex/) — Project instructions and optional hooks
- [Agent Workflows](/docs/guides/agent-workflows/) — Turn tool operations into committed task evidence
────────────────────────────────────────────────────────────────────────
## Agent Harnesses & Skills
URL: https://gitkb.com/docs/reference/agent-harnesses/
Section: Getting Started
---
title: Agent Harnesses & Skills
description: GitKB harness installers, shared skills, MCP configuration, and hook support.
---
# Agent Harnesses & Skills
GitKB provides harness-specific installers and a stdio MCP server. Inspect `git-kb init --help` for the installers included in your binary.
## Integration paths
| Harness | Setup command | Installed integration |
| ------------------ | ----------------------------------- | ------------------------------------------------------------------------------- |
| Claude Code | `git-kb init claude` | Claude rules, skills, project instructions, and MCP configuration. |
| Codex | `git-kb init codex` | Codex skills and instructions; optional home installation or hook plugin. |
| Cursor | `git-kb init cursor` | Cursor skills, rules, and `.cursor/mcp.json`. |
| Windsurf | `git-kb init windsurf` | Windsurf skills, rules, and MCP configuration. |
| OpenCode | `git-kb init opencode` | `.opencode/` skills and rules, plus `opencode.json` MCP configuration. |
| oh-my-pi | `git-kb init oh-my-pi` | `.omp/` skills and rules, plus `.omp/mcp.json`. |
| Grok Build | `git-kb init grok` | `.grok/` skills and rules, plus `.grok/config.toml`. |
| OpenClaw | `git-kb init openclaw` | `.agents/` skills and rules; prints instructions for global MCP registration. |
| Google Antigravity | `git-kb init antigravity` | `.agents/` skill and rule symlinks, `.agents/mcp_config.json`, and `AGENTS.md`. |
| pi | `git-kb init pi` | `.pi/` skills and rules; MCP access requires a pi MCP extension. |
| Generic MCP client | Run `git-kb mcp` through the client | Tool access through MCP; configure the client separately. |
Preview an install before changing project files:
```bash
git-kb init claude --dry-run
git-kb init codex --dry-run
git-kb init opencode --dry-run
```
The extra harness installers share GitKB's skills and rules. They do not all implement the same lifecycle hooks. Check each command's help and generated assets for the integration you use.
## Shared skill content
The installers keep canonical project workflows under `.kb/skills/` and common rules under `.kb/rules/`. Harness directories expose those assets in their native layout, usually through symlinks.
```text
.kb/skills/ # Shared GitKB workflows
.kb/rules/ # Shared code-intelligence and KB rules
.claude/skills/ # Claude Code skill adapters
.codex/skills/ # Codex skill adapters
.cursor/skills/ # Cursor skill adapters
.windsurf/skills/ # Windsurf skill adapters
```
## Included skills
| Area | Skills |
| ---------------------- | ------------------------------------------------------------------------------ |
| KB operations and sync | `gitkb`, `remote-sync` |
| Task workflow | `kb-board`, `kb-tasks`, `kb-start`, `kb-progress`, `kb-review`, `kb-close` |
| Knowledge management | `kb-create`, `kb-search`, `kb-context`, `kb-status`, `kb-commit`, `kb-handoff` |
| Code intelligence | `code-intelligence`, `explore`, `understand`, `refactor-safety` |
Skills provide workflow instructions. MCP tools provide structured operations. An agent follows the operator's task and project rules when deciding which operations to run.
## Codex options
```bash
# Preview a home-level asset installation
git-kb init codex --install-home --dry-run
# Preview the GitKB plugin bundle, including hooks and MCP configuration
git-kb init codex --install-hooks --dry-run
```
`--install-home` installs skills and instructions under `CODEX_HOME`; `--copy` copies assets instead of symlinking them. `--install-hooks` installs the GitKB Codex plugin bundle. Review the preview, then run the same command without `--dry-run` to install.
## Generic MCP clients
Configure a stdio server with command `git-kb` and argument `mcp`. Set the project working directory or `GITKB_ROOT` so the server selects the intended KB. Use [MCP Setup](/docs/getting-started/mcp-setup/) for configuration examples.
## Related docs
- [Claude Code](/docs/getting-started/claude-code/) — Claude setup.
- [Codex](/docs/getting-started/codex/) — Codex setup.
- [Agent Workflows](/docs/guides/agent-workflows/) — Tasks, checkouts, and verification.
- [MCP Tools](/docs/reference/mcp-tools/) — Tool reference.
- [CLI Reference](/docs/cli-reference/) — Installed command help.
────────────────────────────────────────────────────────────────────────
## Claude Code
URL: https://gitkb.com/docs/getting-started/claude-code/
Section: Getting Started
---
title: Claude Code
description: Install GitKB workflows, project rules, hooks, and MCP configuration for Claude Code.
---
# GitKB with Claude Code
GitKB's Claude Code integration installs project guidance, reusable skills, session hooks, and a local MCP server entry.
## Scaffold the integration
After [initializing your KB](/docs/getting-started/quick-start/), preview the generated files:
```bash
git-kb init claude --dry-run
git-kb init claude
```
The scaffold installs these files at the KB root:
```text
.kb/
├── skills/ # Canonical GitKB workflow skills
└── rules/ # Canonical project rules
.claude/
├── skills/ # Links to .kb/skills/
├── rules/ # Links to .kb/rules/.md
└── settings.json # SessionStart and PreToolUse hooks
.mcp.json # gitkb server: git-kb mcp
CLAUDE.md # GitKB section pointing to .kb/AGENTS.md
```
The MCP server lives in the root `.mcp.json`. `.claude/settings.json` contains hooks: a session hook starts the daemon if needed, and a tool hook supplies code-intelligence guidance for supported tool calls.
The installer merges the MCP configuration and `CLAUDE.md` section with existing content. Existing workflow templates are kept unless you request an update with `--force`. Review the dry run before replacing customized templates:
```bash
git-kb init claude --force --dry-run
```
## Workflows and rules
The generated rules cover code intelligence, refactoring safety, and knowledge management. Skills include `gitkb`, `code-intelligence`, `explore`, `understand`, `refactor-safety`, `remote-sync`, and task workflows such as `kb-start`, `kb-review`, and `kb-close`.
The canonical skills are under `.kb/skills/`; the Claude entries point to them. See [Agent Harnesses & Skills](/docs/reference/agent-harnesses/) for the full inventory.
## Use the integration
Start Claude Code in the project and enable the GitKB MCP server when prompted. Ask for a concrete read to check the connection:
> "Use GitKB to show the task board and read the project context."
For code work:
> "Find the callers of authenticate, then show the impact of changing src/auth.ts."
For a task:
> "Read tasks/auth-refactor, implement its acceptance criteria, and record the verification results in the task."
The instructions guide the workflow. Check the resulting source, command output, and task evidence before treating the work as complete.
## Next steps
- [MCP Setup](/docs/getting-started/mcp-setup/) — Manual server configuration and connection checks
- [Codex](/docs/getting-started/codex/) — Codex integration
- [Agent Workflows](/docs/guides/agent-workflows/) — Context, assignment, and committed evidence
- [CLI Reference](/docs/cli-reference/) — `init` options
────────────────────────────────────────────────────────────────────────
## Codex
URL: https://gitkb.com/docs/getting-started/codex/
Section: Getting Started
---
title: Codex
description: Install GitKB skills and project instructions for Codex, with optional home and hook integration.
---
# GitKB with Codex
GitKB's Codex integration installs reusable workflows and a project instruction entry point. Connect the MCP server separately to give Codex access to the KB tools.
## Scaffold project guidance
After [initializing your KB](/docs/getting-started/quick-start/), preview and install the integration:
```bash
git-kb init codex --dry-run
git-kb init codex
```
The scaffold creates:
```text
.kb/skills/ # Canonical GitKB workflow skills
.codex/
├── skills/ # Links to .kb/skills/
└── instructions/
├── codex-rules.md
└── gitkb-process.md
AGENTS.md # GitKB workflow section and .kb/AGENTS.md pointer
```
The root `AGENTS.md` supplies the project entry point. The installer preserves existing content while adding its GitKB section. Skills include `remote-sync` alongside code-intelligence and task workflows; see [Agent Harnesses & Skills](/docs/reference/agent-harnesses/) for the inventory.
## Connect MCP
Register the stdio server:
```bash
codex mcp add gitkb -- git-kb mcp
codex mcp list
```
Codex stores MCP settings in its `config.toml`. Run sessions in the project so GitKB finds the intended `.kb/`, or set `GITKB_ROOT` explicitly in the server configuration. See [MCP Setup](/docs/getting-started/mcp-setup/) and the [official OpenAI MCP documentation](https://developers.openai.com/codex/mcp).
## Optional home installation
To expose the integration through your Codex home, run:
```bash
git-kb init codex --install-home
```
This uses `$CODEX_HOME` when set, otherwise `~/.codex`. Use `--copy` when you want copied assets instead of symlinks. Preview either operation with `--dry-run`.
## Optional hooks
Install GitKB's Codex plugin bundle explicitly when you want its code-intelligence hooks:
```bash
git-kb init codex --install-hooks --dry-run
git-kb init codex --install-hooks
```
This writes the plugin bundle under `.codex/plugins/gitkb/` and registers it with Codex. Restart Codex, then review the installed hooks with `/hooks`, as the installer instructs. The bundle includes MCP configuration; inspect existing server entries when combining it with a manual MCP setup.
## Example workflow
The same commands are available through the CLI or corresponding MCP tools:
```bash
git-kb context --compact --code-refs
git-kb board --json
git-kb checkout tasks/auth-refactor
git-kb workspace path tasks/auth-refactor --json
git-kb code callers authenticate --json
# Edit the task's workspace file to record findings and verification.
git-kb commit -m "Record auth refactor verification" tasks/auth-refactor --json
```
Keep the task's scope, acceptance criteria, and actual verification results together so another session can continue from the evidence.
## Next steps
- [Claude Code](/docs/getting-started/claude-code/) — Claude integration
- [Agent Workflows](/docs/guides/agent-workflows/) — Session and task workflow
- [Code Intelligence](/docs/core-concepts/code-intelligence/) — Symbols, calls, and impact
- [CLI Reference](/docs/cli-reference/) — `init codex` options
────────────────────────────────────────────────────────────────────────
## Knowledge Engineering
URL: https://gitkb.com/docs/core-concepts/knowledge-engineering/
Section: Core Concepts
---
title: Knowledge Engineering
description: What GitKB means by knowledge engineering, and how a knowledge base becomes the source that working software is built from.
---
# 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.
```mermaid
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| D
```
The 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](/docs/core-concepts/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](/docs/core-concepts/knowledge-graph/)) |
| Grounding in code | A code intelligence index of symbols, callers and callees, linked from documents with `[[code:path::symbol]]` ([Code Intelligence](/docs/core-concepts/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:
```markdown
---
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]].
```
```bash
# 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 origin
```
The 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](/blog/knowledge-engineering/): the argument behind the practice.
- [Documents](/docs/core-concepts/documents/): types, frontmatter and lifecycle.
- [Knowledge Graph](/docs/core-concepts/knowledge-graph/): relationships and queries.
- [Agent workflows](/docs/guides/agent-workflows/): how agents read and update the knowledge base.
────────────────────────────────────────────────────────────────────────
## Documents
URL: https://gitkb.com/docs/core-concepts/documents/
Section: Core Concepts
---
title: Documents
description: Document types, frontmatter, workspaces, commits, and history.
---
# Documents
A GitKB document has a stable identity, a slug, YAML frontmatter, and a Markdown body. The slug is its readable address, such as `tasks/auth-flow`. Renaming a slug preserves document identity and records a change in history.
## Types and frontmatter
Use types to distinguish intent: tasks describe work, specs describe behavior, incidents describe failures, and notes hold general knowledge. The built-in types are `task`, `spec`, `note`, `decision`, `skill`, `reference` and `incident`, and custom types work too. Context documents, which hold project state, are any documents under the `context/` slug folder by convention; view documents hold saved queries.
```yaml
---
slug: tasks/auth-flow
title: Implement authentication
type: task
status: active
priority: high
tags: [auth, api]
parent: tasks/auth-epic
blocked_by: [tasks/session-store]
implements: [specs/auth]
---
## Acceptance criteria
- [ ] Sign-in creates a session.
- [ ] Expired sessions are rejected.
```
`git-kb create` supplies identity and version metadata. Give it a type and title, and either choose a slug or let GitKB derive one. Status is a string, so your project can choose values such as `draft`, `backlog`, `active`, `blocked`, and `completed`; these are conventions rather than an enforced transition sequence.
Common fields include `priority`, `tags`, `assignee`, `agent_id`, `worktree`, `parent`, `blocked_by`, `depends_on`, `implements`, `references`, and `external_refs`. `assignee` identifies the assigned person or agent; `agent_id` is a separate agent/session binding. Graph-derived fields such as `blocks` should be understood through the [knowledge graph](/docs/core-concepts/knowledge-graph/).
## The editing lifecycle
```mermaid
flowchart TD
Create["create: pending document"] --> Edit["Edit workspace Markdown"]
Checkout["checkout: editable copy"] --> Edit
Edit --> Review["status and diff"]
Review --> Commit["commit: record history"]
Commit --> Push["push: publish selected work"]
Pull["pull: acquire documents"] --> Checkout
Commit --> Checkout
```
Create a document in the current workspace:
```bash
git-kb create task --slug tasks/auth-flow --title "Implement authentication" --json
git-kb workspace path tasks/auth-flow --json
```
Edit the returned file, then commit it:
```bash
git-kb status --json
git-kb diff
git-kb commit -m "Define authentication work" tasks/auth-flow
```
For an existing document, start with `git-kb checkout tasks/auth-flow`. Workspace paths are `.kb/workspaces//...`; use `git-kb workspace path` rather than assuming the name, especially in linked Git worktrees.
Metadata updates use the same workflow:
```bash
git-kb set tasks/auth-flow status=completed priority=high
git-kb diff
git-kb commit -m "Complete authentication work" tasks/auth-flow
```
`set` leaves a pending workspace edit. With several agents or several changed documents, always pass the slugs you changed to `commit`.
## Canonical storage and history
Committed documents, commits, document tips and stashes live in GitKB's local store under `.kb/`. Workspace files are pending edits. Query indexes are derived from the store and can be rebuilt.
Each document change records its version and previous document commit. SHA-256 hashes connect the new document bytes to the prior version's hash. Commit IDs are SHA-256 content hashes. The ancestry belongs to each document, so a commit touching several documents can link to a different predecessor for each one.
Inspect a document and its history with:
```bash
git-kb show tasks/auth-flow --json
git-kb log tasks/auth-flow --json
```
## Querying
```bash
git-kb list --type task --status active --tags auth --json
git-kb list --assigned-to agent-1 --json
git-kb list --unassigned --unblocked --json
git-kb search "authentication session" --json
git-kb search "authentication session" --all-terms --json
```
Keyword search ranks matches in titles, content, and tags. `--all-terms` requires every query term. Use JSON in scripts to retain complete slugs, IDs, and stable fields.
With semantic search initialized and indexed, semantic search can find related documents by meaning:
```bash
git-kb semantic search "session expiration" --json
```
Embeddings are generated and searched locally; they are not synced. See [configuration](/docs/reference/configuration/) for model settings.
## Assignment
```bash
git-kb assign tasks/auth-flow agent-1 --json
git-kb commit -m "Assign authentication work" tasks/auth-flow
```
Assignment updates `assignee` and rejects a conflicting owner unless `--force` is supplied. It is local to the KB's current state; sync carries committed changes to other peers. Use `git-kb unassign tasks/auth-flow` to clear the binding, then commit that edit.
## Saved views
A `view` document stores a query. Save board flags, then run the view against current data:
```bash
git-kb board --group-by priority --type task --save views/task-priorities
git-kb view views/task-priorities --json
```
## Next steps
- [Knowledge Graph](/docs/core-concepts/knowledge-graph/) — Relationships, containment, and code references
- [Team Collaboration](/docs/guides/team-collaboration/) — Sparse sync and remote recovery
- [Code Intelligence](/docs/core-concepts/code-intelligence/) — Connect documents to source code
────────────────────────────────────────────────────────────────────────
## Knowledge Graph
URL: https://gitkb.com/docs/core-concepts/knowledge-graph/
Section: Core Concepts
---
title: Knowledge Graph
description: Link documents, inspect dependencies, and connect knowledge to code.
---
# 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:
```markdown
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
```bash
# 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 --json
```
Supported 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:
```bash
git-kb link tasks/auth-flow --to specs/auth
```
Review pending changes and commit the affected document. See [CLI Reference](/docs/cli-reference/) for code links, commit links, and ordering options.
## Previewing changes
```bash
git-kb status --json
git-kb diff
```
`status` 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.
```bash
git-kb app list --json
git-kb external-refs --help
```
## Next steps
- [Documents](/docs/core-concepts/documents/) — Workspace editing and canonical history
- [Code Intelligence](/docs/core-concepts/code-intelligence/) — Call graphs, impact, and document references
- [Agent Workflows](/docs/guides/agent-workflows/) — Load and traverse task context
────────────────────────────────────────────────────────────────────────
## Code Intelligence
URL: https://gitkb.com/docs/core-concepts/code-intelligence/
Section: Core Concepts
---
title: Code Intelligence
description: Explore indexed symbols, calls, imports, execution flows, and change impact in a Git repository.
---
# Code Intelligence
GitKB parses source files with tree-sitter and builds an index of symbols, calls, imports, and implementation relationships. Use it to locate definitions, trace callers and callees, and inspect the likely impact of a change.
## Start with a Git repository
Code intelligence works in a Git repository without `git-kb init`:
```bash
cd your-project
git-kb code index --json
git-kb code symbols validateToken --json
git-kb code callers validateToken --json
```
Without a knowledge base, the index lives in Git's private metadata. In an initialized KB, it lives in the KB's local indexes and can connect code symbols to documents. Ordinary CLI code queries read the index directly; they do not require a daemon or an embedding model.
See [Supported Languages](/docs/reference/supported-languages/) for file extensions and differences in extraction coverage.
## Indexing
```bash
# Index the current directory
git-kb code index --json
# Index a directory or a file
git-kb code index src/ --json
git-kb code index src/auth.ts --json
# Preview the files without storing an index
git-kb code index --dry-run --json
# Rebuild changed files and remove entries for files that no longer exist
git-kb code index --prune src/ --json
```
Indexing respects `.gitignore` and `.gitkbignore`. Use `.gitkbignore` to exclude generated code or fixtures that you still track in Git. Content hashes let subsequent runs skip unchanged files.
In a full KB, the [daemon](/docs/core-concepts/daemon/) watches registered source roots and schedules incremental indexing after changes. Without it, re-run `git-kb code index` to refresh the index.
## Definitions and call relationships
```bash
# List definitions in a file
git-kb code symbols --file src/auth.ts --json
# Find direct callers and callees
git-kb code callers validateToken --json
git-kb code callees login --json
# Follow additional levels of callers
git-kb code callers validateToken --depth 2 --json
```
A name can match several symbols. Copy the complete `symbol_id` from JSON output when you need one exact definition. Add `--strict` to callers or callees to reject an ambiguous name.
Call resolution uses names, imports, implementation relationships, and language-specific hints. Dynamic dispatch, macros, generated code, and unsupported syntax can leave calls unresolved. The graph describes indexed relationships; inspect the source and index health when a missing edge matters.
## Change impact and unused-code candidates
```bash
# Direct callers of symbols in this file
git-kb code impact src/auth.ts --json
# Expand the traversal
git-kb code impact src/auth.ts --depth 2 --json
# Find unused-code candidates in a file, with classification evidence
git-kb code dead --file src/auth.ts --explain --json
```
Impact analysis follows recorded call edges up to the requested depth and result limit. Dead-code analysis finds symbols without recorded callers and filters inferred entrypoints, public symbols, and tests by default. Use `--include-entrypoints`, `--include-public`, or `--include-tests` to inspect those groups. Treat candidates as a review list before deleting code.
## Entrypoints, flows, and graph queries
```bash
# Refresh inferred entrypoints and execution flows
git-kb code entrypoints --refresh --json
git-kb code flows --refresh --json
git-kb code flow --json
# Run typed query templates
git-kb code query hotspots --json
git-kb code query unresolved-by-reason --json
git-kb code query dead-code-explain --json
```
Entrypoints and flows are derived from the indexed graph. Query templates also cover public APIs, routes, cross-file coverage, and cross-service impact. Run `git-kb code query --help` for the available templates and options.
## Inspect source and structure
```bash
# Return files, symbols, and health as one payload
git-kb code map --path-prefix src/ --detail symbols --json
# Use an exact symbol ID from the symbols or map output
git-kb code show --json
git-kb code shape --json
# Return a caller/callee subgraph
git-kb code graph validateToken --depth 2 --json
# Inspect the parser's syntax tree
git-kb code dump-ast src/auth.ts --lines 10-25 --json
```
`show` returns metadata and source lines. `shape` returns a function's control structure and cyclomatic complexity. `graph` returns nodes and edges for a symbol neighborhood or a whole file.
## Branches and linked worktrees
Indexing detects the Git branch; `--branch` overrides it. Queries normally use the configured default branch. An explicit `--branch` applies overlay semantics: indexed feature-branch files override their default-branch counterparts, while other files use the default index.
```bash
git-kb code index --worktree /path/to/worktree --json
git-kb code callers validateToken --branch feature/auth --json
# Preview removal of indexes for branches that are no longer live
git-kb code prune --stale --dry-run --json
```
Configure per-repository default branches under `[code.repo_default_branch_map]` in `.kb/config.toml` when repositories do not use `main`. `code prune` removes branch indexes; `code index --prune` removes entries for deleted files.
## Link documents to code
In a full KB, use a code wikilink in a document:
```markdown
The auth refactor changes [[code:src/auth.ts::validateToken]].
```
GitKB extracts `references_code` relationships. Find the documents that reference a symbol with:
```bash
git-kb code docs src/auth.ts::validateToken --json
```
`git-kb code refs ` finds where a name is used in code instead.
## Check index health
```bash
git-kb code stats --json
git-kb code doctor --json
```
Use these when a file is missing, calls remain unresolved, or results look stale. If `edges_pending_files` is nonzero, some files still need their call edges rebuilt; zero callers for those files is incomplete evidence. Re-run indexing for the affected paths. `git-kb code index --force` rebuilds even files whose content hashes are unchanged.
## Next steps
- [Daemon](/docs/core-concepts/daemon/) — Source watching and background services
- [Supported Languages](/docs/reference/supported-languages/) — Extraction coverage
- [CLI Reference](/docs/cli-reference/) — Commands and flags
────────────────────────────────────────────────────────────────────────
## Daemon
URL: https://gitkb.com/docs/core-concepts/daemon/
Section: Core Concepts
---
title: Daemon
description: The per-KB service for MCP requests, sync, file watching, incremental indexing, events, and embeddings.
---
# Daemon
The GitKB daemon provides a shared service for one knowledge base. It handles MCP requests, keeps the knowledge base in sync with its default remote, watches document workspaces and source files, schedules indexing, and manages embeddings and event subscriptions.
CLI commands that write to the knowledge base go through the daemon and start one if none is running; a running daemon is always used. To write without starting one, pass `--no-daemon` (or set `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`). Read-only code queries such as `git-kb code callers` read the local index directly.
## Architecture
On macOS and Linux, clients normally connect through `.kb/.cache/gitkb.sock`. Deeply nested KB paths use a hashed socket path under `/tmp` when the normal path exceeds the platform limit. Windows uses a named pipe derived from the KB root.
```mermaid
flowchart TD
Files[Source file changes] --> Watcher[Source watcher]
Watcher -->|Debounced file events| Events[Event bus]
Events --> Pipeline[Incremental index pipeline]
Pipeline --> Index[Persisted code index]
CLI[CLI code queries] --> Index
Agent[Agent MCP client] --> MCP[git-kb mcp]
MCP --> Socket[Per-KB socket]
Socket --> Daemon[Daemon handlers]
Daemon --> Index
```
The watcher reports changes; the index pipeline extracts symbols and resolves relationships. Queries read the resulting index. Separate KBs have separate daemon endpoints.
## Start and inspect
MCP and commands that write to the knowledge base start the daemon automatically.
```bash
# Run in the foreground
git-kb daemon start
# Or start a background process
git-kb daemon start --background
# Inspect status and registered workspaces
git-kb daemon status --json
git-kb workspace list --json
# Stop or restart
git-kb daemon stop
git-kb daemon restart
```
Use `git-kb workspace status --json` and `git-kb code doctor --json` to check workspace checkouts and repository indexing state.
Commands that need the daemon start a lease-scoped one automatically; it can stop once no command is using it. Start a daemon yourself (`git-kb daemon start --background`) when you want it to keep running, for example to keep the knowledge base in sync.
## Sync
A running daemon keeps the knowledge base converged with its **default remote**: on an interval (`daemon.sync_interval_secs`) it runs the automatic sync steps — pull, replay your unpublished commits, publish — so a healthy knowledge base stays in sync without commands.
- It stops at anything that needs a decision, such as a conflict. `git-kb sync status --json` lists those rows and the command each one needs.
- It never writes into a document you are editing. That document waits until you commit or pull it yourself.
- Other remotes sync only when you run `git-kb sync converge `.
## File watching
The source watcher respects `.gitignore` and `.gitkbignore` and batches rapid saves with a default 500 ms debounce. It publishes file-change events, and the daemon schedules incremental indexing for registered source roots and linked worktrees.
```bash
git-kb code index src/ --json
git-kb daemon status --json
```
Indexing is asynchronous. A saved file can still be waiting in a batch or indexing queue when a query runs. Check `git-kb code doctor --json` and daemon logs if results are missing or stale.
The workspace watcher monitors `.kb/workspaces/` for document edits. Those files remain pending edits until an explicit `git-kb commit`; watching does not commit your work.
## Embeddings
Initialize local semantic search and index committed documents on demand:
```bash
git-kb semantic init
git-kb semantic index --json
git-kb semantic status --json
```
See [Configuration](/docs/reference/configuration/) for `[embeddings]` settings (`backend`, `model`, `batch_size`, `batch_delay_ms`). Model loading initializes lazily on demand; document and code services remain available while embeddings initialize, and memory use depends on the selected model, backend, and vector indexes.
## Events
Subscribe to the daemon's event stream from the CLI:
```bash
git-kb events --filter 'code:*' --count 10 --idle-timeout 30
```
Events let integrations observe KB and code-index changes without repeatedly querying for updates. The CLI exposes filters and NDJSON output; see [CLI Reference](/docs/cli-reference/) for the current options.
## Logs and diagnostics
```bash
# Inspect recent background-process logs
git-kb daemon logs --tail 100
# Follow new log entries
git-kb daemon logs --follow
# Run a foreground daemon with verbose logging
git-kb --verbose daemon start
# Inspect configuration and code-index health
git-kb doctor --json
git-kb code doctor --json
```
Foreground logs go to the terminal. A background daemon writes `.kb/.cache/daemon.log`.
## Next steps
- [MCP Setup](/docs/getting-started/mcp-setup/) — Connect an agent to the service
- [Code Intelligence](/docs/core-concepts/code-intelligence/) — Query indexed code
- [Configuration](/docs/reference/configuration/) — Configure the KB
- [Troubleshooting](/docs/reference/troubleshooting/) — Diagnose service problems
────────────────────────────────────────────────────────────────────────
## Agent Workflows
URL: https://gitkb.com/docs/guides/agent-workflows/
Section: Guides
---
title: Agent Workflows
description: Use project context, scoped tasks, code intelligence, and committed evidence across agent sessions.
---
# Agent Workflows
GitKB keeps project knowledge outside an agent's conversation. A session can read committed context, work within a task, and leave evidence for the next session.
## Start with context and scope
A practical session loop is:
1. Read the project's agent instructions and context.
2. Inspect active tasks and blockers.
3. Read the selected task's scope and acceptance criteria.
4. Implement the scoped change and run its checks.
5. Update the task with the changed files and actual check results, then commit it.
```bash
git-kb context --compact --code-refs
git-kb board --json
git-kb context tasks/auth-refactor --code-refs --token-budget 4000
```
The positional document slug selects a graph-aware context bundle. Without a slug, `context` produces session bootstrap context. `--compact` omits document bodies from bootstrap output; use the document form when you need task content within a token budget.
## Project instructions and skills
The harness scaffold installs an entry point to GitKB's project workflow. Claude uses a root `CLAUDE.md` section and `.claude/` assets; Codex gets a root `AGENTS.md` section and `.codex/` assets. Generic MCP clients need project instructions supplied through their own configuration. MCP exposes tools and server guidance; it does not make every client load arbitrary local instruction files.
The canonical skills live under `.kb/skills/`, with harness adapters pointing to them:
| Phase | Skills |
| ----------------------- | --------------------------------------------------------------- |
| Orient | `gitkb`, `kb-context`, `kb-board`, `kb-tasks` |
| Start | `kb-start`, `kb-create`, `kb-search` |
| Understand code | `code-intelligence`, `explore`, `understand`, `refactor-safety` |
| Inspect progress | `kb-status`, `kb-progress`, `kb-review` |
| Finish | `kb-close`, `kb-commit`, `kb-handoff` |
| Resolve sync divergence | `remote-sync` |
See [Agent Harnesses & Skills](/docs/reference/agent-harnesses/) for installation details.
## Keep context focused
A common scaffold convention groups context by stability:
| Path | Content |
| ---------------------- | ------------------------------------- |
| `context/immutable/` | Project brief, architecture, patterns |
| `context/extensible/` | Product and technology context |
| `context/overridable/` | Active work and progress |
These are workflow conventions, not storage restrictions. Update them when the project changes. Keep task scope, decisions, and verification in the task document so later sessions can trace the work.
## Select ready work
`git-kb ready` ranks eligible tasks using priority, blocking fanout, recency, and document type. It filters out work that is already assigned, blocked, or completed:
```bash
git-kb ready --json
git-kb ready --limit 3 --json
git-kb ready --context --budget 12000
```
The JSON result has a `tasks` array. For a script using `jq`, extract a candidate with:
```bash
task_slug=$(git-kb ready --json | jq -r '.tasks[0].slug // empty')
```
Selection is a read of the current local KB. Another worker can select the same candidate before an assignment is committed and shared.
## Record assignment and status
`assign` checks the document's current committed assignee and rejects a different existing assignee unless forced. Like `set`, it stages a workspace edit. Commit the assignment before relying on it in subsequent committed-state queries:
```bash
git-kb assign tasks/auth-refactor agent-alex --json
git-kb set tasks/auth-refactor status=active
git-kb diff
git-kb commit -m "Assign auth refactor" tasks/auth-refactor --json
```
For a remote team, publish the assignment with `git-kb push origin tasks/auth-refactor`. Assignment helps coordinate work, but separate replicas can race; it is not a distributed lease. See [Team Collaboration](/docs/guides/team-collaboration/).
At completion, record evidence in the task's workspace file before committing status and releasing the assignment:
```bash
git-kb set tasks/auth-refactor status=completed
git-kb unassign tasks/auth-refactor --json
git-kb diff
git-kb commit -m "Complete auth refactor with verification" tasks/auth-refactor --json
```
Use your project's status conventions. A status label records a claim; source changes and command results establish whether the acceptance criteria pass.
## Follow live changes
The daemon publishes local KB events as NDJSON. Start it if needed, then subscribe:
```bash
git-kb daemon start --background
git-kb events --filter 'document:*' --path 'tasks/' --idle-timeout 60
```
`--filter` selects event types. `--path` filters document events by slug prefix; non-document events pass through it. Use `--count 10` to stop after ten matching events. Events describe daemon activity; use committed document reads and history for durable state.
## Next steps
- [Team Collaboration](/docs/guides/team-collaboration/) — Sparse sync and assignment limits
- [Documents](/docs/core-concepts/documents/) — Checkout, pending edits, and commit
- [Code Intelligence](/docs/core-concepts/code-intelligence/) — Ground code changes in indexed relationships
────────────────────────────────────────────────────────────────────────
## Team Collaboration
URL: https://gitkb.com/docs/guides/team-collaboration/
Section: Guides
---
title: Team Collaboration
description: Share selected documents, understand per-document history, and coordinate edits across local replicas.
---
# Team Collaboration
GitKB separates the knowledge you hold locally from the documents you are editing. Pull the documents needed for a task, checkout the ones you will change, then commit and publish those changes.
## Two levels of selection
- **Selection** chooses the documents your local store holds and keeps in sync with a remote. A pull of a path adds it to the selection.
- **Checkout** materializes local documents in `.kb/workspaces//` for editing.
You can query committed local documents without checking them out. Each Git worktree has its own checkout workspace.
```mermaid
flowchart TD
WA["Workspace A: pending edits"] -->|"commit"| LA["Local store A"]
LA -->|"push whole commits"| R["Remote KB"]
R -->|"pull selected history"| LB["Local store B"]
LB -->|"checkout"| WB["Workspace B: editable Markdown"]
WB -->|"commit"| LB
LB -->|"push"| R
```
## Per-document history
A GitKB commit can contain changes to several documents. Each document keeps its own history, so ancestry follows the earlier changes to that document rather than one global branch.
```text
tasks/auth: v1 -> v2 -> v3
specs/api: v1 -> v2
```
Changes to unrelated documents can advance independently. Changes to the same document can diverge and require reconciliation. The receiver also validates history and commit integrity, so version mismatch is not the only reason a push can be rejected.
A new physical commit is published completely and atomically. Scoped push selects the work to publish; a multi-document commit still travels as a complete immutable object. Keep unrelated changes in separate commits when you want to share them independently.
A pull fetches the selected documents and their history. A retained shared commit may also mention other documents. Those incidental siblings are not automatically acquired as live documents or checked out. Shared commit bytes can still contain their change text, so a pathspec is not a redaction mechanism.
## Configure a remote
Use the sync URL supplied by the KB you want to share. A GitKB.com KB has the form `https://gitkb.com/api/v1/sync//`:
```bash
git-kb remote add origin https://gitkb.com/api/v1/sync/your-org/your-kb
git-kb remote list --json
git-kb login origin
```
The remote is recorded in `.kb/config.toml`. GitKB may record a GitKB.com URL in its short form, `gitkb://gitkb.com/your-org/your-kb`; both name the same KB. The first remote you add becomes the default remote (`sync.default_remote`), which bare `sync status` and `sync converge` act on.
For a token instead of sign-in, give a token source rather than the token itself: `--token-env `, `--token-file ` or `--token-command `. HTTP and HTTPS sync endpoints are also supported for self-hosted servers. Add other remotes with distinct names and remove one with `git-kb remote remove `.
## Choose what you sync
A client syncs only its selection, a set of patterns per remote, read like Git's sparse-checkout cone mode. The default remote starts with `@local`: every document this store holds stays in sync with no decision. Widen or narrow it with `git-kb sync select`:
```bash
# Add patterns: a folder selects every document under it, now and later.
git-kb sync select tasks/ context/ --remote origin
# Select every document the remote has.
git-kb sync select --all --remote origin
# Replace the patterns instead of adding to them.
git-kb sync select --set context/ --remote origin
# Show the patterns and the documents they select.
git-kb sync select --list --remote origin
```
A document that leaves the selection is removed locally on the next `sync converge`, once its local commits are published; a checkout with uncommitted edits is held until you commit or clear it, and its log is kept.
The daemon converges the default remote in the background every `daemon.sync_interval_secs`, so a healthy KB stays in sync without commands. Any other remote is converged only when you run `git-kb sync converge `. Change the default with `git-kb config set sync.default_remote `.
## Pull the documents you need
Push and pull require an explicit remote:
```bash
# Acquire documents, including ones not held locally.
git-kb pull origin tasks/auth-refactor --json
git-kb pull origin context/ --json
```
Quote globs so your shell does not expand them into local filenames. Pathspecs read the same way in push, pull, fetch, `sync status` and `sync converge` as in local commands; [Troubleshooting](/docs/reference/troubleshooting/#a-pathspec-matches-nothing-or-too-much) covers how they match and what a miss returns.
A pull without pathspecs refreshes locally held documents. To request every remote document explicitly, use `/` or the quoted `**`, which match every path (`*` matches top-level slugs only):
```bash
git-kb pull origin --json
git-kb pull origin '**' --json
```
There is no `pull --all` flag. To keep every remote document in sync, select them with `git-kb sync select --all`. Pulling all documents is a choice to expand your local replica; most task workflows can stay scoped.
## Edit and publish
```bash
git-kb checkout tasks/auth-refactor
git-kb workspace path tasks/auth-refactor --json
# Edit the returned workspace file.
git-kb diff
git-kb commit -m "Record auth refactor plan" tasks/auth-refactor --json
git-kb push origin tasks/auth-refactor
```
Use explicit document pathspecs for commits so other pending edits stay separate. Inspect what is held locally with `git-kb list --json`, and inspect checkout state with `git-kb workspace checkouts --json`.
## Coordinate task ownership
Assignment is a local check against the document's committed `assignee`. It stages the change for a separate commit:
```bash
git-kb assign tasks/auth-refactor agent-alex --json
git-kb set tasks/auth-refactor status=active
git-kb commit -m "Assign auth refactor" tasks/auth-refactor --json
git-kb push origin tasks/auth-refactor
```
Inspect ownership through the board:
```bash
git-kb board --unassigned --json
git-kb board --assigned-to agent-alex --json
```
After recording completion evidence, release the assignment and commit it:
```bash
git-kb unassign tasks/auth-refactor --json
git-kb commit -m "Release auth refactor assignment" tasks/auth-refactor --json
git-kb push origin tasks/auth-refactor
```
Assignment helps workers on a shared local KB or synchronized replicas see ownership. It is not a distributed lock: two disconnected replicas can both stage an assignment. Refresh before selecting work, publish claims promptly, and handle a rejected push before assuming ownership is shared.
## Read the plan, run the rows
`git-kb sync status` prints the engine's plan for a remote: one row per action, each with the command that runs it.
```bash
git-kb sync status origin --json
git-kb sync status origin --json -- tasks/auth-refactor
```
Each row has a tier that says who acts:
| Tier | Meaning | What you do |
| ------- | ------------------------------------------------------------------ | ----------------------------------------------------------------------- |
| `auto` | Pull, push, rebase and other steps that need no decision | Run the row's command, or `git-kb sync converge origin` to run them all |
| `agent` | A decision: a conflict, a slug claim, a delete/edit, a selection | Run the command the row prints, choosing one of its decisions |
| `hold` | The remote changed a document you have uncommitted edits to | Run its command (a pull that merges into your file), then converge |
| `info` | Nothing to run | Nothing; the exit code ignores it |
| `human` | Sign-in, an unreachable remote, an upgrade or an integrity problem | Stop and report the row; do not work around it |
`sync status` exits `0` at a fixed point (nothing to do), `70` when auto or agent rows are pending, `71` for a hold and `72` for a human row. `git-kb sync converge` runs the auto tier to a fixed point and stops at the first row that needs you. `git-kb sync show --remote origin` prints a row's details; for a conflict, the base, both sides and the merge. `git-kb sync resolve --remote origin --document --decision ` records an agent decision, exactly as the row's command carries it, then converges. A row still present after you ran its command is a result to report, not to retry.
### Resolve a conflict
A conflict means your unpublished commit and the remote tip changed the same or adjacent lines of a document. When a pull stops at one, the merge is left in the checked-out file with `<<<<<<< ours`, `||||||| base`, `=======` and `>>>>>>> theirs` blocks:
```bash
git-kb pull origin tasks/auth-refactor
git-kb rebase --json
# Edit each conflict block in the workspace file down to the content you want.
git-kb rebase --continue
git-kb push origin tasks/auth-refactor
```
To take one side whole, run `git-kb checkout --ours tasks/auth-refactor` or `git-kb checkout --theirs tasks/auth-refactor`, then continue. `git-kb rebase --abort` discards the stopped rebase.
A `conflict-N` row also prints a command that decides the whole document, such as `git-kb conflict accept tasks/auth-refactor --theirs --local`. `--local` keeps your version, `--remote` takes the remote's and `--auto` takes the one modified more recently. Run it as printed, with one strategy; the `--theirs` value ties the decision to the remote content you saw.
## Share project guidance
Keep `.kb/AGENTS.md` and the harness entry points in your source repository so teammates use the same context and task conventions. KB document sync and Git source sync are separate: pulling KB documents does not update local scaffold files.
## Next steps
- [Agent Workflows](/docs/guides/agent-workflows/) — Context, ready tasks, and verification evidence
- [Documents](/docs/core-concepts/documents/) — Workspace-first edits and commits
- [Configuration](/docs/reference/configuration/) — Remote and daemon settings
- [Migration & Adoption](/docs/guides/migration/) — Roll out gradually
────────────────────────────────────────────────────────────────────────
## Migration & Adoption
URL: https://gitkb.com/docs/guides/migration/
Section: Guides
---
title: Migration & Adoption
description: Add GitKB gradually, starting with code intelligence and a small set of useful project documents.
---
# Migration & Adoption
## Start with one useful workflow
You can use code intelligence in a Git repository before creating a knowledge base:
```bash
git-kb code index --json
git-kb code symbols authenticate --json
```
To add project documents and task context, initialize a KB and your agent integration:
```bash
git-kb init
git-kb init claude # or: git-kb init codex
```
Follow [MCP Setup](/docs/getting-started/mcp-setup/) for clients that need a separate server configuration. Then ask the agent to read the project instructions and help document a real task.
Start with the project's purpose, the architecture needed for that task, and acceptance criteria you can verify. Review the documents before committing them. The scaffold supplies workflows; it does not automatically understand or document the project.
## Bring in existing knowledge
Keep your existing issue tracker and wiki where they serve the team. Add the material you want agents to query and connect to code: architecture decisions, task criteria, incident findings, and current project context.
For a small migration, create a document, copy the relevant Markdown into its workspace file, and commit it:
```bash
git-kb create note --slug notes/auth-overview --title "Authentication overview" --json
git-kb workspace path notes/auth-overview --json
# Copy and review the material in the returned workspace file.
git-kb diff
git-kb commit -m "Add reviewed authentication overview" notes/auth-overview --json
```
Preserve source links where they help explain ownership or freshness. Check for secrets and obsolete claims as you copy material. Creating a document leaves a pending edit; the commit makes it available as committed KB knowledge.
## Build a small context set
The scaffold suggests three groups:
| Group | Examples |
| ---------------------- | ------------------------------------- |
| `context/immutable/` | Project brief, architecture, patterns |
| `context/extensible/` | Product context, technology choices |
| `context/overridable/` | Current focus, progress, blockers |
Use the groups that help your project. Keep the active context short and link to deeper documents instead of repeating them in every task.
## Roll out to the team
Use the sync URL supplied by your hosted or self-hosted KB. A GitKB.com KB has the form `https://gitkb.com/api/v1/sync//`:
```bash
git-kb remote add origin https://gitkb.com/api/v1/sync/your-org/your-kb
git-kb login origin
git-kb push origin context/
```
Commit `.kb/config.toml` to your source repository so teammates get the same remote. A teammate who clones the repository installs GitKB, creates the local store (`init` keeps the committed configuration), selects documents and converges:
```bash
git-kb init
git-kb login origin
git-kb sync select --all --remote origin # or a narrower pattern, such as context/
git-kb sync converge origin
```
For a KB whose configuration is not in the repository, add the remote yourself and pull what you need:
```bash
git-kb init
git-kb remote add origin https://gitkb.com/api/v1/sync/your-org/your-kb
git-kb login origin
git-kb pull origin context/ --json
git-kb init claude # or another supported harness
```
Converging or pulling brings documents into the local store. Checkout creates editable Markdown files under that worktree's `.kb/workspaces//`. Query committed documents without checking them all out, and checkout only what you need to edit.
Share repository agent guidance through your source repository. KB pull syncs KB documents; it does not distribute the scaffold's local rules, skills, or other repository files.
## Upgrading from 0.1
GitKB 1.0 migrates a 0.1 knowledge base to the Protocol 1.0 store once. Preview what the upgrade would convert without changing anything, then run it:
```bash
git-kb upgrade --report
git-kb upgrade
```
The 0.1 layout and its configuration are kept under `.kb/legacy-0.1/` with a migration report. Each `gitkb:////` remote is carried to its sync URL, `https:///api/v1/sync//`, and the 0.1 default remote becomes `sync.default_remote`. Other commands run on a 0.1 store also migrate it first, once. `git-kb upgrade --check` reports the store's upgrade state, and `git-kb upgrade --cleanup` deletes the kept 0.1 layout once you no longer need it.
## Next steps
- [Quick Start](/docs/getting-started/quick-start/) — A complete create-and-commit example
- [Team Collaboration](/docs/guides/team-collaboration/) — Sparse sync and conflict recovery
- [Agent Workflows](/docs/guides/agent-workflows/) — Focused context and task evidence
────────────────────────────────────────────────────────────────────────
## CLI Reference
URL: https://gitkb.com/docs/cli-reference/
Section: Reference
# CLI Reference
## Start a knowledge base
### git-kb init
Initialize a new knowledge base
Usage: git-kb init [OPTIONS] [COMMAND]
Commands:
claude Install Claude Code integration files (.claude/, CLAUDE.md)
codex Install Codex integration files (.codex/, scripts, CODEX_HOME)
cursor Install Cursor integration files (.cursor/skills/, .cursor/rules/)
windsurf Install Windsurf integration files (.windsurf/skills/, .windsurf/rules/)
opencode Install OpenCode integration (opencode.json MCP server + .kb/ assets)
oh-my-pi Install oh-my-pi integration (.omp/mcp.json MCP server + .kb/ assets)
grok Install Grok Build integration (.grok/config.toml MCP server + .kb/ assets)
openclaw Install OpenClaw integration (.kb/ assets; MCP is global — prints how to enable)
antigravity Install Google Antigravity integration (.agents/ symlinks, .agents/mcp_config.json, AGENTS.md)
pi Install pi integration (.kb/ assets; pi has no built-in MCP)
Options:
--remote
Remote to configure: a URL, or an org slug for gitkb:////. Nothing is created on the remote
--cloud-remote
Host of the gitkb:// remote when --remote is an org slug
--org
Organization/namespace for federation
--instance
Instance name within organization
--name
Display name for this KB
--no-verify
Skip connectivity check with remote
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
### git-kb doctor
Diagnose common configuration problems
Usage: git-kb doctor [OPTIONS]
Options:
--check
Only run specific checks (comma-separated). Available: repos, kb
--fix []
Apply safe local repairs, then rerun checks. Bare `--fix` applies every safe repair; `--fix ` applies only that check's repair (kb.projection)
--json
Output as JSON. Agents and scripts should prefer this for stable, complete output
--progress
Emit one NDJSON progress event per line on stderr while checks run
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
### git-kb repair
Repair safe local KB state from canonical store data
Usage: git-kb repair [OPTIONS]
git-kb repair
Commands:
projection Rebuild the document projection from the store
Options:
--from
Re-fetch every damaged or missing object `fsck --full` names, by id, from a configured remote or a backup archive, and verify it
--json
Output as JSON. Agents and scripts should prefer this for stable, complete output
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
### git-kb upgrade
Upgrade a 0.1 knowledge base to the Protocol 1.0 store (the only command that migrates)
Usage: git-kb upgrade [OPTIONS]
Options:
--json
Output as JSON (the report; the first-run line still goes to stderr)
--report
List what the upgrade would convert, cut and leave unmapped, without changing anything
--allow-unmapped
Upgrade without the tips and publications `--report` lists as unmapped (their 0.1 bytes stay under `legacy-0.1/`)
--abort
Undo an interrupted upgrade: put the 0.1 layout back as it was and remove what the upgrade added, so `git-kb upgrade` can run again
--check
Check the store's upgrade state and change nothing: exit 0 only when it is a finished Protocol 1.0 store; otherwise name what to run
--dry-run
Print what would change without touching disk (same as --report)
--rollback
Undo the interrupted upgrade (same as --abort); with --operation, only the one `--check` names
--operation
The interrupted upgrade `--abort` / `--rollback` undoes, as `--check` names it
--cleanup
Delete the 0.1 layout a finished upgrade kept under `.kb/legacy-0.1/`
--root
The project root whose `.kb` to act on (default: found from the current directory)
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
### git-kb info
Show KB statistics and storage info
Usage: git-kb info [OPTIONS]
Options:
--json
Output as JSON. Agents and scripts should prefer this for stable, complete output
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
### git-kb limits
Print the declared sync limits named by `resource over limit` errors
Usage: git-kb limits [OPTIONS]
Options:
--json
Output as JSON. Agents and scripts should prefer this for stable, complete output
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
## Create and manage documents
### git-kb create
Create a new document in the workspace
Usage: git-kb create [OPTIONS] [TYPE]
Arguments:
[TYPE]
Document type (task, spec, note, decision, skill, reference, incident)
Options:
--type
Document type (task, spec, note, decision, skill, reference, incident)
--title
Document title (opens $EDITOR if not provided)
--body
Document body (default: a heading with the title)
--status
Initial status (draft/active/completed)
[default: draft]
--priority
Priority (high/medium/low)
[default: medium]
--tags
Comma-separated tags
--path
Slug prefix (e.g. docs/api); the slug is /
--slug
Explicit slug (overrides title-based generation)
--next
Reserve the next number of this family at a remote and create -
--remote
Remote (name or URL) the number is reserved at (default: the KB's default remote)
--ttl
Seconds the reservation holds the number before the birth must publish
[default: 86400]
--require-remote-reservation
Require a remote reservation for the number: with no remote named or configured, refuse instead of numbering locally
--template
Template to use
--parent
Parent document slug
--component
Component tag
--blocks
Link to existing document (blocks relationship)
--blocked-by
Link to existing document (blocked-by relationship)
--refs
Link to existing document (references relationship)
--json
Output as JSON
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
TYPE is required and can be given positionally or with --type:
git-kb create task --slug tasks/ --title "..." (positional)
git-kb create --type task --slug tasks/ --title "..." (named flag)
Give --slug a folder (tasks/, incidents/, specs/, notes/, ...) or use --next ;
without one the document lands at the top level of the KB.
### git-kb show
Display a document, a historical version, or a commit
Usage: git-kb show [OPTIONS] ...
Arguments:
...
Document slugs or ids, `@`, `'@{}'` (the document as that reflog entry left it), or commit ids: full, or a unique prefix of 4 or more hex digits as `log` and `reflog` print it (`sha256:1f718cee28d5`)
Options:
--json
Output as JSON
--related
Also show summaries of related documents
--no-body
Show metadata only (no body)
--raw-content
Include the verbatim markdown (`rawContent`) in JSON output
--source
Read one document through document.read.v1: `committed`, `workspace` (the invocation's workspace) or `workspace:`
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
### git-kb list
List documents with filtering
Usage: git-kb list [OPTIONS] [PATHSPEC]
Arguments:
[PATHSPEC]
Filter by pathspec, the same as --path
Options:
--type
Filter by document type (repeat or comma-separate for multiple values)
--status
Filter by status (repeat or comma-separate for multiple values)
--priority
Filter by priority (repeat or comma-separate for multiple values)
--tags
Filter by tags (comma-separated)
--path
Filter by pathspec: `specs` is `specs` and every document under it; `specs/*` its direct children; `**` crosses folders; or a document id
-r, --recursive
No-op, kept for compatibility: --path always includes nested documents (use `--path /*` for direct children only)
--in
List ordered children of a container (documents whose `in:` names it)
--count
Return only the matching document count (JSON: {"total": N})
-n, --limit
Maximum number of results (default: no limit)
--offset
Number of results to skip (for pagination)
--sort
Sort by field (built-in: created, modified, title, priority; or any frontmatter field)
--asc
Sort ascending (default depends on field: asc for title/priority, desc for dates and custom fields)
--desc
Sort descending (default depends on field: asc for title/priority, desc for dates and custom fields)
--where
Filter by frontmatter field predicate (e.g. "score > 0.7", "stage = qualified"). Can be repeated; all predicates are ANDed
--since
Filter: modified after date (ISO 8601 date or relative: 7d, 2w, 1m)
--until
Filter: modified before date (ISO 8601 date or relative: 7d, 2w, 1m)
--format
Output format (table, json, ids)
Possible values:
- table: Formatted table (default)
- json: JSON output for scripting and agents (stable, complete fields)
- ids: Document IDs only (one per line)
[default: table]
--json
Output as JSON (shorthand for --format json). Agents and scripts should prefer this for stable, complete output
--unassigned
Show only unassigned documents
--assigned-to
Show only documents assigned to this agent
--unblocked
Show only documents with no unresolved blockers
--no-links
Hide relationship column
--save
Save current list flags as a view document with this slug
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
A bare argument is a pathspec, as --path takes; a type needs --type:
git-kb list context/ (the context/ folder)
git-kb list --type context (documents of type context)
AGENTS/SCRIPTS: use --json for complete, untruncated slugs/IDs and stable fields.
### git-kb search
Search documents by content
Usage: git-kb search [OPTIONS]
Arguments:
Search query (searches title, content, and tags)
Options:
--limit
Maximum number of results
[default: 20]
--type
Filter by document type
--status
Filter by status
--all-terms
Require every query term to match (strict legacy keyword behavior)
--offset
Number of results to skip
--format
Output format (table, json, slugs)
Possible values:
- table: Formatted table (default)
- json: JSON output for scripting and agents (stable, complete fields)
- slugs: Document slugs only (one per line)
[default: table]
--json
Output as JSON (shorthand for --format json). Agents and scripts should prefer this for stable, complete output
--rank-with
Fuse the keyword results with a ranking computed elsewhere, read from this file (`-` for standard input).
The ranking is JSON: {"schema": "gitkb.search.ranking.v1", "documents": ["", …]}, best first. Each document must be live and pass --type and --status, as a keyword hit must; the two rankings are combined by reciprocal-rank fusion, so a document the keyword search missed can still be returned. Extensions such as `git-kb semantic search --hybrid` use this.
--remote
Search a remote KB instead of the local one.
Accepts a remote name (e.g., "origin") or a gitkb:// URL. Calls the cloud FTS endpoint through the gateway.
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
AGENTS/SCRIPTS: use --json for complete, untruncated slugs/IDs and stable fields. Table output is for human display.
### git-kb rm
Delete documents (a tombstone commit; `restore` brings them back)
Usage: git-kb rm [OPTIONS] ...
Arguments:
...
Document IDs, slugs, folders or glob patterns to delete (a spec selecting several documents needs -r)
Options:
-r, --recursive
Recursive, as `git rm -r`: allow a pathspec that selects more than one document (a folder such as `specs/old/`, or a glob)
-f, --force
Force, as `git rm -f`: remove checkouts with local modifications (their bytes are moved to .gitkb/displaced/) and skip pathspecs that match nothing (without it they are refused: exit 17, `pathspec_no_match`)
--dry-run
Dry run - resolve pathspecs and show what would be deleted without modifying the workspace
--hard
Hard delete - destructively purge matching documents and document-only commits (history and bytes; as `git-kb filter --rm`). Takes only ids, exact slugs, folders written as `p/`, or globs: an unmatched bare name, or a folder written without its trailing `/`, is refused even with --force. With --force any other unmatched name is skipped; without it, exit 17 (a lone renamed slug: exit 10, naming the new slug)
--commit
With --hard (0.1): refused, a purge records no commit; kept so 0.1 scripts get that answer (an audit-preserving deletion is `rm -m`)
-m, --message
Commit the deletion at once with this message (default: stage it for `git-kb commit`)
-q, --quiet
Quiet mode (suppress output)
--json
Output as JSON
-v, --verbose
Enable verbose output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
Pathspecs:
that document
tasks/a what is at that slug, when something is; else the folder
tasks/ the folder: tasks and every document under it, at any depth
tasks/* the direct children (*, ? and [...] stay in one folder level)
tasks/** every document under tasks, not tasks itself
**/a a at any depth
/ every document (never exit 17, even on an empty store)
A spec is read as a document id, then exact matches (they come before folder
expansion), then a folder or glob, then a bare name. An exact slug is not
always one document: pass the document id to pick one. rm, rm --hard and filter --rm need -r when one spec selects
more than one document. rm --hard and filter --rm take only an id, an exact
slug, a folder written as tasks/, or a glob: a bare name no document holds,
or a folder written without its trailing / (tasks), is refused (exit 4) even
with --force; any other unmatched name is an ordinary miss. A spec that matches nothing is refused with exit 17
(pathspec_no_match) unless a flag skips it (rm --force); some answer a lone
old slug of a renamed document with exit 10 (document_not_found) naming the
new slug. How drafts, bare names and a renamed document's old slug are read
varies by command. A pathspec
names the starting documents; commit --undo and reset act on whole
commits, so other documents in the commits they drop move too.
### git-kb set
Quick metadata update (workspace-first, commit separately)
Usage: git-kb set [OPTIONS] ...
Arguments:
Document pathspec (ID, slug, or glob pattern)
...
Field=value pairs to set (use +field:value to add, -field:value to remove from arrays)
Options:
-n, --dry-run
Preview changes without applying (dry-run)
-q, --quiet
Quiet mode (suppress output)
-v, --verbose
Enable verbose output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
### git-kb assign
Atomically assign a document to an agent (CAS)
Usage: git-kb assign [OPTIONS]
Arguments:
Document slug to assign
Agent or person ID to assign to
Options:
--force
Force assignment even if already assigned to someone else
--json
Output as JSON. Agents and scripts should prefer this for stable, complete output
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
### git-kb unassign
Clear the assignment on a document
Usage: git-kb unassign [OPTIONS]
Arguments:
Document slug to unassign
Options:
--json
Output as JSON. Agents and scripts should prefer this for stable, complete output
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
### git-kb mv
Move or rename documents
Usage: git-kb mv [OPTIONS] [DEST]
Arguments:
Source document ID, slug, or path (one document; a spec selecting several is refused)
[DEST]
Destination slug or path
Options:
--next
Reserve the next number of this family at a remote and rename onto -
--remote
Remote (name or URL) the number is reserved at (default: the KB's default remote)
--ttl
Seconds the reservation holds the number before the rename must publish
[default: 86400]
-f, --force
Overwrite a destination another document holds: tombstone it (or discard a draft there)
--json
Output as JSON
-q, --quiet
Suppress human output
-v, --verbose
Enable verbose output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
### git-kb templates
Manage document templates
Usage: git-kb templates [OPTIONS] [COMMAND]
Commands:
list List available templates
show Show a template
create Create a new template
edit Edit an existing template
delete Delete a custom template
Options:
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
### git-kb slug
Numbered slug families at a remote (reserve the next number)
Usage: git-kb slug [OPTIONS]
Commands:
next Show the next number of a family at a remote (a preview: it holds nothing)
release Release a number this principal holds reserved at a remote
reservation Inspect, renew, or release an existing remote slug reservation
Options:
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
### git-kb project
Project KB documents to filesystem targets
Usage: git-kb project [OPTIONS] [PATHSPEC]
Arguments:
[PATHSPEC]
Documents to project: a slug (that document and every document under it), `dir/`, a glob (`specs/*` the direct children; `**` crosses folders; `/` every document) or a document id
Options:
--to
Target filesystem path
--rebuild
Drop the native document projection (the `proj_*` tables of the store's index) and rebuild it from the store
--adapter
Adapter to use. v1 supports markdown-document
[default: markdown-document]
--mode
Filesystem projection mode
[default: symlink]
[possible values: symlink, copy]
--name
Use a stable saved-style projection id for this one-shot projection
--require-match
Fail when a folder or glob selects no documents (a slug or id that names nothing always fails)
--dry-run
Preview without writing files
--json
Output stable JSON
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
### git-kb projections
Manage saved document projections
Usage: git-kb projections [OPTIONS]
Commands:
list List saved and materialized projections
save Save a projection recipe in .kb/projections.toml
resolve Resolve a saved projection without writing files
apply Apply a saved projection
diff Diff a saved projection against current sources and targets
clean Remove stale outputs owned by a saved projection
remove Remove a projection and its owned outputs
doctor Diagnose a saved projection
Options:
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
## Organize with relationships and views
### git-kb link
Add a document to a container with ordering
Usage: git-kb link [OPTIONS]
Arguments:
Document to link (ID or slug)
Options:
--to
Container to link to
--position
Position: first, last (default), after:, before:
[default: last]
--code
Code symbol to link (e.g., src/auth.rs::login)
--repo
Repository name for commit linking (must match [repos] in config.toml)
--commit
Commit SHA for commit linking (requires --repo)
--json
Output the result as JSON
-q, --quiet
Quiet mode (suppress output)
-v, --verbose
Enable verbose output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
### git-kb unlink
Remove a document from a container
Usage: git-kb unlink [OPTIONS] --from
Arguments:
Document to unlink (ID or slug)
Options:
--from
Container to unlink from
--json
Output the result as JSON
-q, --quiet
Quiet mode (suppress output)
-v, --verbose
Enable verbose output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
### git-kb reorder
Reorder a document within a container
Usage: git-kb reorder [OPTIONS] --position
Arguments:
Container document (ID or slug)
Child document to reorder (ID or slug)
Options:
--position
New position: first, last, after:, before:
--json
Output the result as JSON
-q, --quiet
Quiet mode (suppress output)
-v, --verbose
Enable verbose output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
### git-kb graph
Visualize document relationships
Usage: git-kb graph [OPTIONS] [PATHSPEC]...
Arguments:
[PATHSPEC]...
Document pathspec(s) (ID, slug, or glob pattern). Multiple pathspecs produce a merged graph
Options:
-d, --depth
How many levels of relationships to traverse
[default: 1]
-D, --direction
Which direction to traverse relationships
Possible values:
- out: Outgoing relationships only
- in: Incoming relationships only
- both: Both directions
[default: both]
-t, --rel-type
Filter by relationship type (can specify multiple)
-f, --format
Output format
Possible values:
- tree: Tree view (default)
- json: JSON output
- dot: Graphviz DOT format
- mermaid-gantt: Mermaid gantt chart
- plan: Execution plan: dependency waves (JSON)
[default: tree]
--json
Output as JSON (shorthand for --format json). Agents and scripts should prefer this for stable, complete output
--critical-path
Compute and show the critical path (longest dependency chain)
--scope
Add every task in this status as a root (merged with any pathspecs)
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
AGENTS/SCRIPTS: use --json for complete, untruncated slugs/IDs, relationship targets, and stable fields. Tree output is for human display.
### git-kb board
Display ASCII kanban board
Usage: git-kb board [OPTIONS]
Options:
--type
Filter to specific document type (e.g. task, note, context, incident)
--tags
Filter by tags
--priority
Filter by priority
--where
Filter by frontmatter field predicate (e.g. "score > 0.7"). Can be repeated; all predicates are ANDed
--group-by
Group by a frontmatter property instead of status
Groups documents into columns by the specified property value. For example, --group-by priority creates columns for each priority level. Array properties like tags place documents in multiple columns.
--columns
Explicit column order (comma-separated, requires --group-by)
Controls which columns appear and in what order. Values not in this list appear as additional columns at the end.
--sort-by
Sort items within columns by a frontmatter property
--sort-direction
Sort direction: "asc" or "desc" (default: asc)
--unassigned
Show only unassigned documents
--assigned-to
Show only documents assigned to this agent
--unblocked
Show only documents with no unresolved blockers
--json
Output as JSON for tooling. Agents and scripts should prefer this for stable, complete output
--titles
Show document titles below each slug
[aliases: --title]
--width
Column width for board display (auto-detected from terminal if not set)
--save
Save current board flags as a view document with this slug
--summary
Print one compact line of non-zero status counts (e.g., "22 active · 3 blocked")
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
AGENTS/SCRIPTS: use --json for complete, untruncated slugs/IDs and stable fields. ASCII board output is for human display.
### git-kb view
Execute a saved view
Usage: git-kb view [OPTIONS]
Arguments:
View document slug to execute
Options:
--json
Output as JSON. Agents and scripts should prefer this for stable, complete output
--document
Execute a dedicated view using an exact source and generation
--request-stdin
Read the bounded document view request as JSON on stdin
--limit
Override limit for list/table/timeline layouts
--offset
Override offset for pagination
--no-body
Show metadata only (no body). Only applies when falling back to show
--related
Also show summaries of related documents. Only applies when falling back to show
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
## Workspace
### git-kb checkout
Materialize documents to workspace
Usage: git-kb checkout [OPTIONS] [PATHSPEC]...
Arguments:
[PATHSPEC]...
Document ids, slugs, folders or globs (`tasks/` every document under tasks, `tasks/*` its direct children; see --help)
Options:
--status
Checkout documents by status
--type
Checkout documents by type
--tag
Checkout documents by tag
--force
Displace dirty bytes to .kb/workspaces//.gitkb/displaced/ instead of refusing
--ours
Take the local side of the document's merge conflict whole (the edits as they were before the merge), as git's `checkout --ours`
--theirs
Take the tip's side of the document's merge conflict whole, as git's `checkout --theirs`
-q, --quiet
Suppress output
--json
Output as JSON
-v, --verbose
Enable verbose output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
Pathspecs:
that document
tasks/a what is at that slug, when something is; else the folder
tasks/ the folder: tasks and every document under it, at any depth
tasks/* the direct children (*, ? and [...] stay in one folder level)
tasks/** every document under tasks, not tasks itself
**/a a at any depth
/ every document (never exit 17, even on an empty store)
A spec is read as a document id, then exact matches (they come before folder
expansion), then a folder or glob, then a bare name. An exact slug is not
always one document: pass the document id to pick one. rm, rm --hard and filter --rm need -r when one spec selects
more than one document. rm --hard and filter --rm take only an id, an exact
slug, a folder written as tasks/, or a glob: a bare name no document holds,
or a folder written without its trailing / (tasks), is refused (exit 4) even
with --force; any other unmatched name is an ordinary miss. A spec that matches nothing is refused with exit 17
(pathspec_no_match) unless a flag skips it (rm --force); some answer a lone
old slug of a renamed document with exit 10 (document_not_found) naming the
new slug. How drafts, bare names and a renamed document's old slug are read
varies by command. A pathspec
names the starting documents; commit --undo and reset act on whole
commits, so other documents in the commits they drop move too.
### git-kb status
Show KB state (uncommitted changes, etc.)
Usage: git-kb status [OPTIONS] [PATHSPEC]...
Arguments:
[PATHSPEC]...
Limit to these documents (slugs, ids, globs, or workspace paths)
Options:
-s, --short
One line per file, clean files included
--json
Output as JSON
--no-graph
Skip the graph changes a commit would make (`graph_changes` is then empty): they read every changed document's committed base
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
### git-kb diff
Show workspace changes against the checkout baselines
Usage: git-kb diff [OPTIONS] [PATHSPEC|REVISION]...
Arguments:
[PATHSPEC|REVISION]...
Limit to these documents (slugs, ids, globs, or workspace paths); or exactly two revisions ( or @) to diff against each other
Options:
--commit
Commit or range to diff (git `show ` / `diff A..B`): each document of the commit from its state before it, or from before to after (e.g. abc1234, abc1234..def5678)
--remote
Diff the local document tips against a remote (name or URL): the remote tips are fetched first (no reference moves, no file changes)
--three-way
With --remote: also show the base-to-local and base-to-remote diffs from the tips' common ancestor
--token-stdin
With --remote: read a bearer token for the remote from stdin (first line), presented in place of its configured credential and never stored; without it, $GITKB_REMOTE_TOKEN when set
--name-only
Show only changed paths
--stat
Show per-document insertion and deletion counts
--json
Output as JSON
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
### git-kb commit
Create a KB commit from workspace changes
Usage: git-kb commit [OPTIONS] [PATHSPEC]...
Arguments:
[PATHSPEC]...
Limit to these documents (ids, slugs, folders, globs, or workspace paths; see --help)
Options:
-a, --all
Every changed document (without a PATHSPEC, more than one changed document needs --all)
-m, --message
Commit message (opens $EDITOR if not provided)
--close
Remove committed files from workspace after commit
--amend
Fold the changes into the commit the documents sit on (unpublished only)
--undo
Drop the commit the documents sit on, keeping its content as drafts (unpublished only)
-q, --quiet
Suppress output
--json
Output as JSON
-v, --verbose
Enable verbose output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
Pathspecs:
that document
tasks/a what is at that slug, when something is; else the folder
tasks/ the folder: tasks and every document under it, at any depth
tasks/* the direct children (*, ? and [...] stay in one folder level)
tasks/** every document under tasks, not tasks itself
**/a a at any depth
/ every document (never exit 17, even on an empty store)
A spec is read as a document id, then exact matches (they come before folder
expansion), then a folder or glob, then a bare name. An exact slug is not
always one document: pass the document id to pick one. rm, rm --hard and filter --rm need -r when one spec selects
more than one document. rm --hard and filter --rm take only an id, an exact
slug, a folder written as tasks/, or a glob: a bare name no document holds,
or a folder written without its trailing / (tasks), is refused (exit 4) even
with --force; any other unmatched name is an ordinary miss. A spec that matches nothing is refused with exit 17
(pathspec_no_match) unless a flag skips it (rm --force); some answer a lone
old slug of a renamed document with exit 10 (document_not_found) naming the
new slug. How drafts, bare names and a renamed document's old slug are read
varies by command. A pathspec
names the starting documents; commit --undo and reset act on whole
commits, so other documents in the commits they drop move too.
### git-kb stash
Stash workspace changes
Usage: git-kb stash [OPTIONS] [PATHSPEC]... [COMMAND]
Commands:
push Set dirty files and drafts aside (the default)
list Show every stash
apply Bring a stash back and keep it
pop Bring a stash back and drop it
drop Remove a stash without applying it
show Show the entries of a stash (default: the newest)
clear Remove every stash
Arguments:
[PATHSPEC]...
Limit `stash` (push) to these documents (slugs, ids, globs, or workspace paths)
Options:
-m, --message
Stash message (shown by `stash list` and `stash show`)
--json
Output as JSON
-v, --verbose
Enable verbose output
-q, --quiet
Suppress non-essential output
--color
Color output mode
Possible values:
- auto: Auto-detect TTY
- always: Always use colors
- never: Never use colors
[default: auto]
--log-format
Log output format (pretty, compact, json)
Possible values:
- pretty: Human-readable with colors (default)
- compact: Compact single-line format
- json: JSON format for machine parsing and agent workflows
[default: pretty]
--no-pager
Disable pager for commands that support it
--no-daemon
Do not start the daemon for store writes (a running one is still used); also `GITKB_NO_DAEMON=1` or `daemon.auto_start = false`
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
### git-kb reset
Discard workspace changes
Usage: git-kb reset [OPTIONS] [PATHSPEC]...
Arguments:
[PATHSPEC]...
`[] [...]`: with a commit first (an id or unique prefix, @