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.
shell
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:

PhaseSkills
Orientgitkb, kb-context, kb-board, kb-tasks
Startkb-start, kb-create, kb-search
Understand codecode-intelligence, explore, understand, refactor-safety
Inspect progresskb-status, kb-progress, kb-review
Finishkb-close, kb-commit, kb-handoff
Resolve sync divergenceremote-sync

See Agent Harnesses & Skills for installation details.

Keep context focused

A common scaffold convention groups context by stability:

PathContent
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:

shell
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:

shell
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:

shell
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.

At completion, record evidence in the task’s workspace file before committing status and releasing the assignment:

shell
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:

shell
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