Skip to content

Protocol Specification

The Brainfile protocol defines a structured format for project tasks stored in markdown files with YAML frontmatter.

v2 Architecture

Brainfile v2 uses a directory-based structure:

Your Repository.brainfile/├──brainfile.md# Board config├──board/# Active tasks└──logs/# Completed archiveCLIMCP ServerAI Agents
.brainfile/
├── brainfile.md        # Board Configuration
├── board/              # Active task files
│   ├── task-1.md
│   └── epic-1.md
└── logs/               # Completed task files
    └── task-2.md

File Discovery

PathPriorityNotes
.brainfile/brainfile.md1 (preferred, v2)Directory-based architecture
brainfile.md2Root file (legacy compat)
.brainfile.md3Hidden, backward compat

Completion

Completion Model

Completed tasks are moved from board/ to logs/ via brainfile complete. There is no "done" column by default — completion is a file-level operation that archives the task.

board/brainfile completelogs/

YAML Structure

Board Config (brainfile.md)

yaml
---
title: string              # Required
columns:                   # Required
  - id: string             # Required — unique kebab-case identifier
    title: string          # Required — display title
    completionColumn: boolean  # Optional — auto-complete on move

# All below are optional
type: board
schema: string
protocolVersion: string
strict: boolean            # Enforce type validation
types:                     # Custom document types
  epic:
    idPrefix: epic
    completable: true
  adr:
    idPrefix: adr
    completable: false
agent:
  instructions: []
  llmNotes: string
rules:
  always: []
  never: []
  prefer: []
  context: []
---

Minimal Example

The smallest valid board config:

yaml
---
title: My Project
columns:
  - id: todo
    title: To Do
---

Task File (board/task-1.md)

yaml
---
id: task-1                 # Required — unique ID
type: task                 # Optional — defaults to "task"
title: Implement feature   # Required
column: todo               # Required (active tasks)
priority: high             # Optional
assignee: codex            # Optional
tags: [backend]            # Optional
relatedFiles: [src/main.ts]  # Optional
parentId: epic-1           # Optional
dueDate: "2026-03-01"     # Optional
subtasks:                  # Optional
  - id: task-1-1
    title: Write tests
    completed: false
contract:                  # Optional
  status: ready
  deliverables:
    - path: src/feature.ts
---

## Description
Task details here.

## Log
- 2026-02-18T10:00:00Z: Created

Minimal Example

The smallest valid task file:

yaml
---
id: task-1
title: My task
column: todo
---

Field Reference

Board Fields

FieldTypeRequiredDescription
titlestringYesProject or board title
typestringNoDocument type (default: board)
schemastringNoJSON schema URL for validation
protocolVersionstringNoProtocol version
strictbooleanNoEnforce type validation
typesobjectNoCustom document types
agentobjectNoAI agent instructions
rulesobjectNoProject rules
columnsarrayYesWorkflow columns
statsConfigobjectNoStatistics configuration

Column Fields

Columns are config-only in v2 (no embedded tasks):

FieldTypeRequiredDescription
idstringYesUnique identifier (kebab-case)
titlestringYesDisplay title
completionColumnbooleanNoAuto-complete on move

Task Fields

Each task is a standalone .md file in .brainfile/board/:

FieldTypeRequiredDescription
idstringYesUnique ID (pattern: {type}-N, e.g., task-1, epic-2)
typestringNoDocument type (default: task)
titlestringYesTask title
columnstringYes*Column ID (*required for active tasks, omitted in logs/)
descriptionstringNoDetailed description (markdown)
prioritystringNolow, medium, high, critical
effortstringNotrivial, small, medium, large, xlarge
assigneestringNoPerson/agent responsible
dueDatestringNoISO 8601 date
tagsarrayNoString tags for filtering
relatedFilesarrayNoFile paths
blockedByarrayNoTask IDs that block this task
subtasksarrayNoSubtask objects
contractobjectNoAgent contract
createdAtstringNoISO 8601 timestamp
updatedAtstringNoISO 8601 timestamp, set on mutations
completedAtstringNoSet when moved to logs/
parentIdstringNoParent document ID (any type)
positionnumberNoSort position within the column

Subtask Fields

FieldTypeRequiredDescription
idstringYesUnique ID (e.g., task-1-1)
titlestringYesSubtask title
completedbooleanYesCompletion status

Standard Column IDs

These IDs are conventional but not required. The default brainfile init creates todo and in-progress:

IDPurpose
backlogTasks not yet scheduled
todoTasks to be started
in-progressTasks being worked on
reviewTasks pending review

No default "done" column

In v2, task completion is handled by moving files from board/ to logs/ via brainfile complete. A "done" column is not created by default. You can optionally add one with completionColumn: true if you want auto-completion behavior.


Agent Instructions

The agent block guides AI assistant behavior:

yaml
agent:
  instructions:
    - Modify only the YAML frontmatter
    - Preserve all IDs
    - Keep ordering
    - Make minimal changes
    - Preserve unknown fields
  llmNotes: "Prefer functional patterns and comprehensive tests"
InstructionReason
Modify only YAML frontmatterContent after --- is user documentation
Preserve all IDsChanging IDs breaks references
Keep orderingMaintains visual consistency
Make minimal changesReduces merge conflicts
Preserve unknown fieldsFuture-proofs against extensions

Rules Block

Project rules for AI and human reference:

yaml
rules:
  always:
    - id: 1
      rule: write tests for new features
    - id: 2
      rule: update task status as you work
  never:
    - id: 1
      rule: commit directly to main
  prefer:
    - id: 1
      rule: functional patterns over classes
  context:
    - id: 1
      rule: TypeScript monorepo with Jest

Schema Reference

Official Schemas

TypeURL
Basehttps://brainfile.md/v2/base.json
Boardhttps://brainfile.md/v2/board.json
Taskhttps://brainfile.md/v2/task.json
Contracthttps://brainfile.md/v2/contract.json
Epichttps://brainfile.md/v2/epic.json
ADRhttps://brainfile.md/v2/adr.json

Browse all: brainfile.md/v2/

Type Inference

When type is omitted, tools detect by:

  1. Schema URL pattern (/v2/board.json → board)
  2. Structural analysis (columns[] → board)
  3. Default: board

ID Patterns

ID Assignment

IDs are auto-generated by the CLI and must never be changed manually. Changing an ID breaks all references — parentId, blockedBy, and subtask IDs all depend on stable document IDs.

Document IDs

Pattern: {type}-N where N is a sequential number.

yaml
- id: task-1    # Standard task
- id: task-15
- id: epic-1    # Epic
- id: adr-3     # Architecture Decision Record

Subtask IDs

Pattern: {taskId}-N where N is a sequential number within the parent task.

yaml
# For a task with id: task-1
subtasks:
  - id: task-1-1
  - id: task-1-2

Version History

v2.0.0 (Current)

  • Per-task file architecture (board/, logs/)
  • Custom document types with strict mode
  • Epic and ADR as first-class types
  • Contract system with lifecycle
  • parentId linking model

1.0.0 (Legacy)

  • Single-file embedded tasks
  • Board-only task management
  • Full MCP tool support

v0.5.0

  • Added base schema with inheritance
  • Added agent.tools for CLI tool configuration

v0.4.0

  • Added protocolVersion field
  • Added effort and blockedBy task fields
  • Added llmNotes to agent block

v0.3.0

  • Changed default to non-hidden files (brainfile.md)
  • Added agent instruction block
  • Added subtasks support

Best Practices

  1. Use non-hidden files — Better visibility, AI-friendly
  2. Include agent instructions — Consistent AI behavior
  3. Preserve IDs — Never regenerate or change task IDs
  4. Use semantic IDs — Sequential task-1, task-2
  5. Keep descriptions concise — But informative
  6. Archive completed tasks — Keep board clean

Example

Board Config (.brainfile/brainfile.md)

yaml
---
title: My Project
type: board
schema: https://brainfile.md/v2/board.json
columns:
  - id: todo
    title: To Do
  - id: in-progress
    title: In Progress
strict: true
types:
  epic:
    idPrefix: epic
    completable: true
agent:
  instructions:
    - Update task status as you work
    - Preserve all IDs
rules:
  always:
    - id: 1
      rule: write tests for new features
---

# My Project

Project documentation can go here.

Task File (.brainfile/board/task-1.md)

yaml
---
id: task-1
type: task
title: Implement user authentication
column: todo
priority: high
tags: [backend, security]
subtasks:
  - id: task-1-1
    title: Setup OAuth provider
    completed: false
  - id: task-1-2
    title: Create login UI
    completed: false
---

## Description
Add OAuth2 support for Google and GitHub.

Next Steps

Released under the MIT License.