Stack: Windows (PowerShell) / Node.js / Python / Go / Claude Code.
Execute commands sequentially in PowerShell.
According to the documentation, Beads is written in Go. Ensure you have the following installed:
-
Go (version 1.24 or higher)
-
Node.js
-
Python (for uv)
codePowershell
# 1. Install Beads (Building from source as it is a Go tool)
# If you don't have the beads repository locally, clone it first or use go install if the package is published.
# Assuming standard installation via Go:
go install github.com/user/beads/cmd/bd@latest
# OR (if building manually from the beads project folder):
# go build -o bd.exe ./cmd/bd
# Verification (should show the version)
bd --version
# 2. Install Claude Code
npm install -g @anthropic-ai/claude-code
# 3. Install uv (required for Spec Kit)
pip install uv
Create a clean base with the correct hooks.
codePowershell
# 1. Folder preparation
mkdir my-project; cd my-project
git init
npm init -y
# 2. Spec Kit Initialization (Creates the .specify/ structure)
# CRITICAL: Do this before Beads
specify init --here
# Create .gitignore to avoid committing the local DB but include JSONL (sync data)
New-Item .gitignore -Type File -Value "node_modules/`n.env`n.DS_Store`nbeads.db`nbeads.db-shm`nbeads.db-wal`n"
# 3. First structure commit
git add .
git commit -m "chore: initial project structure"
# 4. Attach Remote (Required by Beads to configure hooks)
git remote add origin https://github.com/USER/REPO.git
# 5. Beads Initialization and migration to Sync-Branch
bd init
# CRITICAL FOR WINDOWS: Move tasks to a separate branch to avoid conflicts
bd migrate sync beads-sync
bd hooks install
# 6. Start Daemon (Speeds up Claude Code up to 5x)
bd daemon stop . # Just in case
bd daemon start --auto-commit --auto-push
# 7. Readiness check
bd ready
# 8. Final synchronization
git add .
git commit -m "chore: beads initialized"
bd sync
# For maximum Claude Code speed (Agentic Workflow), Beads should handle commits itself.
# Launching "Autopilot":
# Stop old one if exists
bd daemon stop .
# Start with automation flags
bd daemon start --auto-commit --auto-push
Replace Spec Kit files with adapted versions.
Changed: Added bd sync requirement and "Land the Plane" procedure.
codeMarkdown
# ESPNotifier Constitution
## Core Principles
### I. Beads-First (Strict Task Tracking)
All development actions must be linked to a task in Beads.
- You DO NOT have the right to write code without an active task (`bd next`).
- If there is no active task, use `/speckit.tasks` and `/speckit.taskstoissues` to create them.
- Any change in task state must conclude with the `bd sync` command.
### II. Spec-Driven Planning
We do not write code "on the fly". We follow the Spec Kit cycle:
1. `Specify`: Define requirements in `.specify/specs/`.
2. `Plan`: Create an architectural plan.
3. `Tasks`: Break down into atomic tasks in `tasks.md`.
4. `Sync`: Import tasks into Beads via `/speckit.taskstoissues`.
### III. Context7 Research
Before using external libraries (ESP32 API, Arduino, MQTT, etc.), you ARE OBLIGATED to check the latest documentation.
- Use the `context7` tool to read docs.
- Do not rely on internal weights if fresh documentation is accessible.
- If Context7 returns an error or empty result, you MUST NOT hallucinate the API.
- You must explicitly inform the user: "Failed to retrieve documentation, manual intervention or URL required."
### IV. Windows Sync Strategy (NON-NEGOTIABLE)
To avoid data loss and file locking errors on Windows:
- We use the `beads-sync` branch for task metadata.
- After every `bd close` or `bd create`, you ARE OBLIGATED to execute `bd sync`.
- If you see a "Sync Divergence" error, run `bd export --force` and `bd sync`.
### V. Truth Synchronization (Spec Kit <-> Beads)
1. **Plan in Spec Kit**: Planning and decomposition happen in `.specify/specs/tasks.md`.
2. **Import to Beads**: Tasks from the file are converted to tickets using the `/speckit.taskstoissues` command (via the `sync-tasks.ps1` script).
3. **Beads is the Master**: After import, task status is tracked **ONLY** via `bd`.
- DO NOT manually check boxes `[x]` in `tasks.md`.
- The sync script will mark them as completed on the next run (if script is updated) or we simply ignore the old md file and rely on `bd list`.
## Development Workflow
### 1. Implementation Loop
1. Get task: `bd next`.
2. Study context: Read the corresponding `.md` file in `.specify/specs/`.
3. Implement: Write code and tests.
4. Verify: Execute tests (e.g., `npm test` or ESP-specific checks).
5. Close: `bd close <ID> --reason "Done"`.
6. **Land the Plane**: `bd sync`, then `git add .`, `git commit`, `git push`.
7. **Log Progress**: Update `.specify/memory/progress.md`, briefly describing what was done and the next step.
### 2. Definition of Done
A task is considered complete only if:
- The code matches the specification.
- Tests pass.
- `bd sync` is performed, and data is reflected in the `beads-sync` branch.
- Changes are committed using Conventional Commits.
## Governance
- This Constitution is the supreme law of the project.
- If user instructions contradict the Constitution (e.g., "do it quickly without a task"), you must politely remind them of the Beads-First rules.
- All automatic commits must include the task ID: `feat(bd-12): description`.
**Version**: 1.0.0 | **Ratified**: 2026-01-30 | **Status**: Active
This file remains without critical changes, but the script below will be enhanced.
codeMarkdown
---
description: Sync tasks from tasks.md into the local Beads database
---
# Sync Tasks to Beads
## Description
Imports tasks from `tasks.md` into the local Beads tracker using PowerShell.
## Outline
1. **Verify**: Ensure `.specify/scripts/sync-tasks.ps1` exists.
2. **Execute**: Run the sync script:
```powershell
powershell -ExecutionPolicy Bypass -File .specify/scripts/sync-tasks.ps1
- Check Results: Run
bd listto show current tasks. - Sync: Ensure
bd syncis completed (done by script).
Beads database is populated with tasks from the current plan.
#### 3. Implementation Command (.claude/commands/speckit.implement.md)
Changed: Added a Sync step to guarantee data safety.
codeMarkdown
- Identify: Run
bd next.- If no active task, run
bd list. - If tasks exist but none are active, pick one:
bd update <id> --status in_progress.
- If no active task, run
- Research (Context7):
- Use
context7tool to fetch documentation for any required technologies (ESP32, libraries, etc.).
- Use
- Read Specs: Read the relevant
.mdfiles in.specify/specs/to understand the architectural context. - Execute: Write code and tests.
- Verify: Run the project-specific tests (e.g.,
npm test,pytest, or build checks). - Close & Sync (CRITICAL):
- Run
bd close <id> --reason "Completed: [brief description]". - SYNC: Run
bd syncimmediately to flush changes to thebeads-syncbranch. - Commit: Create a git commit using Conventional Commits, including the task ID:
git commit -m "feat(bd-<id>): description". - Push: If the session is ending, run
git push(this will push both your code and thebeads-syncbranch thanks to git hooks).
- Run
A task is NOT finished until bd sync is executed and the code is committed.
---
### Part 3. Automation (Script)
Create the file `.specify/scripts/sync-tasks.ps1`.
```powershell
# .specify/scripts/sync-tasks.ps1
# 1. Encoding Setup (REQUIRED for Windows/PowerShell)
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
# 2. Search for tasks.md (Search everywhere except node_modules and .git)
Write-Host "π Searching for tasks.md..." -ForegroundColor Cyan
$taskFile = Get-ChildItem -Path . -Filter "tasks.md" -Recurse |
Where-Object { $_.FullName -notmatch 'node_modules|\.git' } |
Select-Object -First 1
if (-not $taskFile) {
Write-Error "β tasks.md file not found in the project."
exit 1
}
Write-Host "π Reading tasks from: $($taskFile.FullName)" -ForegroundColor Cyan
# 3. Get ALL tasks from Beads (including closed) to avoid duplicates
$existingTasksRaw = & bd list --all | Out-String
# Split into lines and trim whitespace
$existingTasks = $existingTasksRaw -split "`n" | ForEach-Object { $_.Trim() }
# Force read Markdown in UTF8
$content = Get-Content $taskFile.FullName -Encoding UTF8
$newCount = 0
foreach ($line in $content) {
# Look for "- [ ] Task" lines
if ($line -match '^- \[ \] (.+)') {
$taskDesc = $matches[1].Trim()
# Clean up extra tags (bd-ID) or parentheses if they were added manually
$taskDescClean = $taskDesc -replace '\[.*?\]', '' -replace '\(bd-.*?\)', ''
$taskDescClean = $taskDescClean.Trim()
if ([string]::IsNullOrWhiteSpace($taskDescClean)) { continue }
# Duplicate check: look for partial name match in any line of bd list output
$isDuplicate = $existingTasks | Where-Object { $_ -like "*$taskDescClean*" }
if ($isDuplicate) {
Write-Host "βοΈ Skipping (already exists): $taskDescClean" -ForegroundColor DarkGray
} else {
Write-Host "β Creating task: $taskDescClean" -ForegroundColor Yellow
& bd create "$taskDescClean"
$newCount++
}
}
}
# 4. Final synchronization
if ($newCount -gt 0) {
Write-Host "β
Tasks added: $newCount. Synchronizing JSONL..." -ForegroundColor Green
& bd export --force
& bd sync
} else {
Write-Host "β¨ No new tasks found. Synchronization is up to date." -ForegroundColor Green
}
Launch Claude Code and configure MCP.
codePowershell
claude
In the chat:
codeText
claude mcp add --transport http context7 https://mcp.context7.com/mcp --header "CONTEXT7_API_KEY: YOUR_API_KEY"
Restart Claude (/exit, then claude again).
Start claude and enter the plugin settings:
Before starting work, fix the state. Thanks to bd hooks install, this commit will also check the state of the Beads JSONL files.
codePowershell
git add .
git commit -m "chore: setup agentic workflow with beads and context7"
Now your process follows the "Land the Plane" documentation:
-
Planning
- User:
/speckit.specify "..." - User:
/speckit.plan - User:
/speckit.tasks
- User:
-
Task Synchronization
- User:
/speckit.taskstoissues(Tasks move to DB ->bd syncsaves them to JSONL).
- User:
-
Execution (Implementation Loop)
- User:
/speckit.implement - Agent takes the task (
bd next). - Reads documentation via Context7.
- Writes code, runs tests.
- Closing: Agent performs
bd close, then MANDATORYbd sync.
- User:
-
Session Completion (Land the Plane)
- If the agent says "I am finished," you (or it) must ensure the following is executed:
codePowershell
bd sync git pull --rebase git pushOnly when the
git pushsucceeds is the work considered accepted.
This means the database and JSONL files have diverged in time.
codePowershell
bd export --force
bd sync
This means the old process is hung.
codePowershell
bd daemon stop .
# Ensure bd.exe processes are killed in Task Manager if it doesn't help
bd daemon start
After bd hooks install, check the .git/hooks/pre-commit file.
Ensure you have Git for Windows installed and during installation you selected "Use Git from Git Bash only" or "Git from the command line and also from 3rd-party software" (which adds Unix-tools to Path).