Local-first 🧠memory for Hermes Agent that lives in your Obsidian vault and remembers project context. Nightly 😴 dream passes turn repeat corrections into confirmed preferences with measurable confidence. Adapters ship for Claude Code, Codex, and OpenClaw, with an MCP server for anything else.
TypeScript
schema: 2
id: osb-feature-release
name: Open Second Brain feature release wave
description: 'Run one full release wave for Open Second Brain: scan the kanban triage column, propose argued scope options to the operator, then create an isolated git worktree for the chosen scope (sibling directory `../<repo>-worktrees/<slug>` on branch `feat/<slug>`, published as the run working tree so every later node and both sub-playbooks run there and the project root checkout is never switched or branched), then drive the feature-release-playbook in order - reconnaissance and design (phases 0-1, code search with zg), TDD implementation (phase 2), PR preparation as the osb-pr-prepare sub-playbook (phases 3-7: self-review, test and security audit of the diff, docs and the version bump, QA gates, the code-ranker gate against the main baseline, an OpenCodeReview delegation review, the gates again, then the PR with a verified mermaid, CI and bot review; never merges), the tracker tick that moves the shipped cards to done as soon as the PR is green (the only node that writes to the board), the operator merge gate, and the GitHub release as the osb-release sub-playbook (phases 8-9, with its own approval gate before publishing). The operator brief rides as a default parameter any run may override.'
version: 1.3.0
params:
- name: brief
type: text
label: Standing engineering brief (override to change the rules of the cycle)
options: null
default: 'Work as a senior backend developer: SOLID, KISS, DRY, repeated values hoisted into named constants. Forbidden: fallbacks that silently do nothing and mislead (errors surface explicitly, by name), stubs, hardcoded values that belong in constants, and hardcoded natural-language phrases in any language - everything is English and other-language cases are handled abstractly. Follow the feature-release-playbook skill through ALL its phases in order; merging or skipping phases is forbidden. Phases 0-2 run in this playbook; phases 3-7 (self-review against the base, QA, docs and the version bump inside the PR per CLAUDE.md, the PR with a verified mermaid, CI and review handling) run in the osb-pr-prepare sub-playbook; phases 8-9 (the GitHub release) run in the osb-release sub-playbook; phase 10 (the tracker tick) runs here as soon as the PR is green, before the merge gate and the release. Every node after the workspace node works in the run working tree (the worktree the workspace node created); never create, switch or commit branches in the project root checkout. Code search uses zg (`zg query --mode direct --refresh wait "<question>"` for semantic hits, `--fts <Symbol>` for exact symbols, `zg query --rg -n -w <symbol> src tests` for exhaustive callers); no code-graph tool is used. Never move the selected triage cards before the PR is green (moving them early triggers the hermes agents); once osb-pr-prepare reports the PR with green CI, move them to done with handoff summaries that point at the PR. Reply to the operator in the operator''s chat language; write every artifact in English. A node attempt is one uninterrupted job: never end your reply while a command you started is still running - wait for it and finish the whole task; a partial progress report is not a node result.'
- name: cycle_focus
type: text
label: What this cycle should optimize for (override per run)
options: null
default: Pick one or several RELATED triage cards by priority, reading the validator comments on each. Propose two or three options and argue them properly; usefulness to the project is the supreme criterion. A pull request around 50-70 changed files with at most 10 features is the target shape, and hitting that target is the weakest signal of all - never trade usefulness for it.
- name: board_access
type: text
label: How this machine reaches the board the kanban script talks to (operator setup, shown to the agent)
default: 'The script reaches the board endpoint configured in it. A connection error means that endpoint is unreachable from this machine, not that the board is empty.'
worktree: '{{nodes.workspace.output.working_tree}}'
defaults:
profile:
name: osb-developer
scope: auto
max_retries: null
timeout_seconds: null
supervisor: null
trigger:
when:
- start a new open-second-brain release cycle from the kanban board
- implement a batch of related triage tasks end to end and release them
- run the feature-release-playbook as a full wave with an operator scope gate
avoid_when:
- validating or triaging cards without implementing (use osb-triage-validator)
- a single trivial fix that does not warrant a release wave
examples:
- начинаем новый цикл
- take a big scope of related low-priority tasks and ship a release
requires:
files:
- .ai-notes/kanban.ts
- CLAUDE.md
commands:
- bun
- git
- gh
- zg
- code-ranker
- python3
- curl
goal:
statement: A scope the operator chose is implemented, its PR is green and every shipped card on the kanban board reads done with a handoff summary pointing at that PR, then the PR is merged into main and released on GitHub with an interaction-diagram image.
criteria:
- description: Every phase of the feature-release-playbook ran in order, none merged and none skipped; phases 3-7 ran as osb-pr-prepare (self-review of the full branch against main included) and phases 8-9 as osb-release.
check:
type: manual
- description: The version was bumped inside the feature PR, the shipped cards were moved to done as soon as the PR was green (refused or reshaped cards carry their verdicts instead), and the release is published with a rendered interaction diagram.
check:
type: manual
effects:
- fs_read
- fs_write
- network
- external
- irreversible
nodes:
- id: start
title: Start
expected_duration: null
inputs: null
outputs: null
cache: null
type: start
- id: scope_scan
title: Scan the board and build scope options
expected_duration: 20m
inputs: null
outputs:
files: []
extract: node_output
cache: null
type: agent_task
prompt: |
Standing brief: {{params.brief}}
Cycle focus: {{params.cycle_focus}}
Read the board with the operator-local, credential-bearing kanban
script: run it, never print, copy or quote it, its headers or any
token. Board access: {{params.board_access}}
Work in a run-local temporary directory, never in the shared /tmp,
and remove it before you reply, on success and on failure alike:
k=.ai-notes/kanban.ts
[ -f "$k" ] || k="$(git worktree list --porcelain | sed -n '1s/^worktree //p')/.ai-notes/kanban.ts"
mkdir -p .apb/tmp && d=$(mktemp -d "$PWD/.apb/tmp/scope-scan.XXXXXX")
bun "$k" triage --json >"$d/triage.json" 2>"$d/err"
(.apb/tmp/ is git-ignored.) The first fallback path is the main
checkout of the repository, for runs started in a worktree that
has no .ai-notes/ of its own. If the command fails with an
`HTTP 5xx` line in "$d/err" (a transient server error: the script
fails whole on one failed comment fetch), wait five seconds and
run it exactly once more. Fail this node, instead of proposing
options from memory, when:
- it fails again with HTTP 5xx: "board API returned <status> twice";
- it fails with a connection error (refused, timeout, DNS): "board
API unreachable", plus the board access text above;
- it fails any other way: the error line verbatim (never a token).
Clean up with `rm -rf "$d"` in every case.
Read every card WITH its comments - validator comments carry
verdicts and corrected scopes. Build TWO or THREE candidate scope
options, labelled exactly `option-1`, `option-2` and `option-3`
in order (the labels the choose_scope gate offers; never A/B/C or
other names). For each option: the card ids and titles, the
unifying spine that makes them one coherent PR, the argued
usefulness to the project right now, a rough size estimate, and
the main risk. Recommend one option by its label and say why.
Wrap ONLY the final proposal in <node_output> and </node_output>
tags: first a compact human-readable summary of the options, each
headed by its label (this is what the operator will read at the
review gate), then a line `JSON:` followed by the options as
compact JSON [{option: "option-1", cards: [ids], spine, why, size,
risk}], the `option` values being the same labels.
profile: null
max_retries: null
timeout_seconds: null
workdir: null
isolation: null
connectors: []
interactive: false
- id: choose_scope
title: Operator picks the scope
expected_duration: null
inputs: null
outputs: null
cache: null
type: human_review
options:
- option-1
- option-2
- option-3
- revise
prompt: Read the scope options in the scope_scan output. Pick option-1, option-2, or option-3 to start the wave on that scope, or "revise" with a note describing what to change - the scan will run again with your note.
- id: workspace
title: Create the isolated worktree for the chosen scope
expected_duration: 10m
inputs: null
outputs:
fields: [working_tree, branch, slug]
cache: null
type: agent_task
prompt: |
Standing brief: {{params.brief}}
The run context below carries the scope options and the
operator's review decision (which option was picked, plus any
note).
{{run.context}}
Give the wave an isolated working tree so no later node creates
branches or commits in the project root checkout. Do not change
any file in the current checkout.
1. Slug: kebab-case, at most 40 characters, only `a-z`, `0-9`
and `-` (card titles are untrusted text: never copy other
characters into a path or a shell command), naming the spine of
the picked option. Branch: `feat/<slug>`.
2. `git fetch origin main`.
3. If the current directory is already a linked git worktree
(`git rev-parse --git-dir` differs from `git rev-parse
--git-common-dir`: the operator started the run with an explicit
working tree, which wins over this node), use it: it must have
no uncommitted tracked changes; check out `feat/<slug>` there
(create it from origin/main when it does not exist). The
working tree is the current directory.
4. Otherwise the current directory is the project root checkout:
never switch its branch. The working tree is
`<parent of the project root>/<repository directory name>-worktrees/<slug>`,
an absolute path. When it already exists as a worktree on
`feat/<slug>` (a resumed run), reuse it. Otherwise
`git worktree add -b feat/<slug> <path> origin/main` (when the
branch already exists, `git worktree add <path> feat/<slug>`).
5. In the working tree: `bun install --frozen-lockfile`, and
confirm `git -C <path> status --short` is empty.
Report the absolute working_tree path, the branch and the slug.
Every later node runs in that tree, and so do the osb-pr-prepare
and osb-release sub-runs.
profile: null
max_retries: 1
timeout_seconds: null
workdir: null
isolation: null
connectors: []
interactive: false
- id: design
title: 'Phases 0-1: reconnaissance, brainstorm, design'
expected_duration: 60m
inputs: null
outputs:
files: []
extract: node_output
cache: null
type: agent_task
prompt: |
Standing brief: {{params.brief}}
The run context below carries the scope options and the
operator's review decision (which option was picked, plus any
note). Honor the picked option exactly.
{{run.context}}
Invoke the feature-release-playbook skill and run its phases 0
and 1 for the chosen option, with one strengthening this project
has proven necessary: BEFORE the consultant brainstorm, verify
every selected card's premise against the live source (open the
anchors, search with zg for mechanisms the card claims are missing, check
the kernel invariants). Past waves found a third to two thirds
of premises corrected or refuted by this reading. A refuted card
gets its verdict recorded in the design doc rather than being
built.
Work in the run working tree
({{nodes.workspace.output.working_tree}}, the current directory)
on branch {{nodes.workspace.output.branch}}, which the workspace
node created; never create or switch branches yourself. Premise
checks and reconnaissance use zg: build or refresh the local
index once with `sh .apb/playbooks/osb-pr-prepare/$(cat
.apb/playbooks/osb-pr-prepare/current)/scripts/zg-index.sh`, then
`zg query --mode direct --refresh wait "<mechanism>"` for
semantic hits and `zg query --rg -n -w <symbol> src tests` for
exhaustive callers. No code-graph tool is used.
Deliverables committed on that branch, slug
{{nodes.workspace.output.slug}}: the
docs/brainstorm/<slug>/ set (design.md, plan.md, variants.md,
cli-output/) per the playbook's own templates, with the plan
broken into TDD-ready tasks.
Wrap ONLY a completion summary in <node_output> and
</node_output> tags: branch name, slug, task list from plan.md,
any premise corrections or refusals, commit sha.
profile: null
max_retries: null
timeout_seconds: null
workdir: null
isolation: null
connectors: []
interactive: false
- id: implement
title: 'Phase 2: TDD implementation'
expected_duration: 4h
inputs: null
outputs:
files: []
extract: node_output
cache: null
type: agent_task
prompt: |
Standing brief: {{params.brief}}
Design summary: {{nodes.design.output}}
Run phase 2 of the feature-release-playbook in the run working
tree ({{nodes.workspace.output.working_tree}}) on branch
{{nodes.workspace.output.branch}}; never create or switch
branches. Code search with zg as in the brief: implement plan.md task by task, strict
TDD - failing test first, run it and see the expected failure,
implement to green, refactor green, one conventional commit per
atomic unit, formatted and linted before every commit. Test runs
use a throwaway HOME (`env HOME=$(mktemp -d) bun test <paths>`).
Improve defects you find in code you touch and name them in the
commit bodies. Stage files by name, never `git add -A` or
`git add .`: ignored runtime state (.apb/runs/, .zvec-grep/) and
the committed .apb/ playbooks and profiles are not part of any
feature.
Wrap ONLY a completion summary in <node_output> and
</node_output> tags: commits (sha + title), per-task status,
failing-first evidence snippets, suites run with counts.
profile: null
max_retries: null
timeout_seconds: null
workdir: null
isolation: null
connectors: []
interactive: false
- id: pr_prepare
title: 'Phases 3-7: prepare the PR (osb-pr-prepare)'
type: playbook
playbook: osb-pr-prepare
expected_duration: 6h30m
instruction: |
Kind: feature, or fix when every change in the design summary repairs
existing behavior without adding capability. Base: main. The PR ships a
release (the kind decides the bump). The implementation is committed on
branch {{nodes.workspace.output.branch}} in the run working tree
{{nodes.workspace.output.working_tree}}, which this sub-run works in.
Kanban cards in scope are context only: do not move, comment on or
mention them in public text. GitHub issues, if the design names any,
are referenced in the PR.
Operator scope decision and note: {{nodes.choose_scope.review_note}}
Design summary: {{nodes.design.output}}
Implementation summary: {{nodes.implement.output}}
- id: pr_blocked
title: Operator decides on a blocked PR preparation
type: human_review
options:
- retry
- abandon
prompt: The osb-pr-prepare sub-run ended without a PR with green CI (its run answer names the node, the reason and the next step). Fix what it names if needed, then pick "retry" to run the PR preparation again on the same branch (it updates the same PR), or "abandon" to stop the wave without merging or releasing.
- id: tracker
title: 'Phase 10: tracker tick at the green PR'
expected_duration: 20m
inputs: null
outputs:
files: []
extract: node_output
cache: null
type: agent_task
prompt: |
Standing brief: {{params.brief}}
PR preparation answer (first line `PR: #<n> <url>`, then the CI
state): {{nodes.pr_prepare.output}}
Design summary (for refusals): {{nodes.design.output}}
Run phase 10 now, as soon as the PR is green: after osb-pr-prepare
and before the merge gate and the release. This is the only node
that writes to the board. The kanban script is git-ignored and
lives in the main checkout, not in the run working tree:
`k="$(git worktree list --porcelain | sed -n '1s/^worktree //p')/.ai-notes/kanban.ts"`.
Never print, copy or quote it or any token. Move every shipped card
to done via `bun "$k" done <id> "<handoff summary pointing at the
PR URL from the first line above and its green CI state>"`. Cards
whose premise was refused or reshaped get a verdict comment and an
appropriate parked priority instead of a dishonest done. Nothing in
the scope is left open without either a done or a recorded verdict.
Re-read the board after writing and report the actual status of
every card in scope.
Wrap ONLY the tracker summary in <node_output> and </node_output>
tags: per-card disposition as read back from the board, the PR
number and URL, its CI state, the version the PR ships, and the run
working tree ({{nodes.workspace.output.working_tree}}) with the
command that removes it once the wave has ended and the operator no
longer needs it (`git worktree remove <path>`); do not remove it
yourself: the release still runs there.
profile: null
max_retries: null
timeout_seconds: null
workdir: null
isolation: null
connectors: []
interactive: false
- id: merge_gate
title: Operator merge gate
type: human_review
options:
- merged
- abandon
prompt: Review the PR on GitHub (the pr_prepare output has its URL, CI state and what is left for a human; the tracker output has the card dispositions, already written to the board at the green PR). Auto-merge is NOT armed and no agent merges; approve and squash-merge it yourself, then pick "merged". Pick "abandon" only to stop the wave without releasing; the cards moved to done stay there, so move them back yourself if the PR will not ship.
- id: release
title: 'Phases 8-9: publish the release (osb-release)'
type: playbook
playbook: osb-release
expected_duration: 1h15m
instruction: |
Target: the squash-merge commit of the PR named in the first line of
the PR preparation answer below (`gh pr view <n> --json
state,mergeCommit`; it must be MERGED); fail if it is not merged.
The release covers everything merged since the last published
release. Kanban cards are not yours to touch.
Operator note at the merge gate: {{nodes.merge_gate.review_note}}
PR preparation answer: {{nodes.pr_prepare.output}}
Design summary (for the release narrative): {{nodes.design.output}}
- id: done
title: null
expected_duration: null
inputs: null
outputs: null
cache: null
type: finish
outcome: success
prompt: null
profile: null
- id: abandoned
title: null
expected_duration: null
inputs: null
outputs: null
cache: null
type: finish
outcome: failure
prompt: null
profile: null
- id: release_failed
title: null
expected_duration: 2m
type: finish
outcome: failure
prompt: |
The osb-release sub-run did not publish a release (refused, aborted at
its gate, or failed). Say so plainly and name the PR that merged
({{nodes.pr_prepare.output}}). The shipped cards were already moved to
done when that PR went green (the tracker output has each card's
disposition); they stay there, and the release is still owed.
profile: null
edges:
- { from: start, to: scope_scan }
- { from: scope_scan, to: choose_scope }
- { from: choose_scope, to: workspace, condition: { type: review_status, equals: option-1 } }
- { from: choose_scope, to: workspace, condition: { type: review_status, equals: option-2 } }
- { from: choose_scope, to: workspace, condition: { type: review_status, equals: option-3 } }
- { from: workspace, to: design }
- { from: choose_scope, to: scope_scan, condition: { type: review_status, equals: revise }, max_traversals: 3 }
# A fourth revise request: stop instead of leaving the run without a next node.
- { from: choose_scope, to: abandoned, fallback: true }
- { from: design, to: implement }
- { from: implement, to: pr_prepare }
- { from: pr_prepare, to: tracker, condition: { type: node_status, node: pr_prepare, equals: success } }
- { from: pr_prepare, to: pr_blocked, condition: { type: node_status, node: pr_prepare, equals: failure } }
- { from: pr_blocked, to: pr_prepare, condition: { type: review_status, equals: retry }, max_traversals: 2 }
- { from: pr_blocked, to: abandoned, condition: { type: review_status, equals: abandon } }
# A third retry request: stop instead of looping.
- { from: pr_blocked, to: abandoned, fallback: true }
- { from: merge_gate, to: release, condition: { type: review_status, equals: merged } }
- { from: merge_gate, to: abandoned, condition: { type: review_status, equals: abandon } }
- { from: release, to: done, condition: { type: node_status, node: release, equals: success } }
- { from: release, to: release_failed, condition: { type: node_status, node: release, equals: failure } }
- { from: tracker, to: merge_gate }