This project can optionally submit concise markdown summaries of completed work items to an external knowledge base called "OpenBrain". The integration is intentionally conservative: submissions are fired-and-forget so they never block or fail the user CLI flow, and failures are recorded to a local retry queue for later inspection/resubmission.
- When a work item transitions to
completed(viawl closeorwl update --status completed) the CLI will attempt to submit a short markdown summary to OpenBrain. - Submission is done by invoking the OpenBrain CLI
ob add --stdin --title <title>and passing the generated markdown on stdin. - The submission is non-blocking: the CLI spawns the child process and returns; submission errors are logged and the entry is appended to a local JSONL retry queue.
- Implementation:
src/openbrain.ts - CLI hooks:
src/commands/close.tsandsrc/commands/update.tscallsubmitToOpenBrain(...)when status transitions tocompleted. - Unit tests:
tests/unit/openbrain.test.ts - Integration tests:
tests/cli/openbrain-close.test.ts
Enable the feature in your project configuration (.worklog/config.yaml):
openBrainEnabled: trueBy default the integration expects the ob CLI to be available on PATH. You can override the binary path with the WL_OB_BIN environment variable (or set it for a single invocation):
WL_OB_BIN=/usr/local/bin/ob wl close WL-0001 -r "done"- If spawning the
obbinary fails (for exampleENOENT) the failure is logged and a JSON object describing the submission is appended to the retry queue file:.worklog/openbrain-queue.jsonl. - If the child process exits with a non-zero status the stderr text (if any) is captured and recorded together with the queued entry.
- Queued entries are written as one JSON object per line with the following fields:
workItemId— the originating Worklog idtitle— the work item titlesummary— the markdown summary that would have been sent to OpenBrainenqueuedAt— ISO timestamp when the entry was queuedreason— optional human-readable reason for queuing (spawn error or stderr)
Summaries are produced by buildOpenBrainSummary(item) (see src/openbrain.ts). The produced markdown contains:
- A top-level heading with the work item title
- A short metadata block containing the work item id, type, assignee and completed timestamp
- An
## Objectivesection containing the item's description (if present) - An
## What was donesection containing the (redacted) audit text if present
Audit text is redacted before it's persisted or submitted. See src/audit.ts for the redaction rules (email-like local parts are obfuscated). OpenBrain submissions therefore use the same redacted audit text shown in human output. Always review your redaction policy before enabling OpenBrain on repositories containing sensitive data.
- Module entrypoints:
submitToOpenBrain(item, options?)— spawn theobprocess and write the markdown summary to stdin. Options allow overriding theobbinary, the spawn implementation (useful for tests), the queue directory, and whether to wait for completion.appendToQueue(entry, queueDir?)— append a JSONL retry entry to the configured worklog directory.resolveObBinary()— resolves theobbinary with respect forWL_OB_BIN.
- Queue file name constant:
OPENBRAIN_QUEUE_FILE(openbrain-queue.jsonl)
The integration does not currently provide an automated resubmission command. To retry queued entries manually you can inspect and resubmit them with a short script. Example (POSIX shell + jq):
QUEUE=.worklog/openbrain-queue.jsonl
if [ -f "$QUEUE" ]; then
while IFS= read -r line; do
title=$(echo "$line" | jq -r '.title')
echo "$line" | jq -r '.summary' | ob add --stdin --title "$title" || echo "Resubmit failed for $title"
done < "$QUEUE"
fiReplace ob with the path in WL_OB_BIN if necessary. Be careful when resubmitting to avoid duplicate entries in OpenBrain.
- Unit tests for the integration are in
tests/unit/openbrain.test.tsand validate summary construction, queue writing and spawn/error handling. - CLI-level integration tests that exercise
wl close/wl updatebehaviours are intests/cli/openbrain-close.test.ts.
- A future enhancement could provide a
wl openbrain resubmitcommand that safely retries queued entries and records outcomes in worklog comments.