Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ Releases of the BoCode template itself. Adopting projects upgrade by handing [UP

When adding an entry, also refresh the collapsed What's-new block near the top of the three READMEs (`README.md`, `README.zh-CN.md`, `README.ja.md`): newest title in the summary line, latest three titles as bullets.

## 2026-11-06 — selected ub-mode practices (ADR-011)

Selected practices from Robert C. Martin's [ub-mode](https://github.com/unclebob/ub-mode/blob/master/SKILL.md) supplement the existing phases where useful: valid state modeling, pure business calculations, behavior-focused tests, evidence-based defect repairs, shared domain terms, and complexity review. Automation samples remain an optional boscope reference, outside the general workflow and review checklist. Project rules and user requirements take precedence over this supplementary guidance. No phases, approval gates, required review items, mandatory tools, or fixed thresholds are added. Context-management, action logs, metrics-tool dependencies, and worktree cleanup are excluded; existing validation and data-ownership rules remain.

- Added: `book/docs/decisions/ADR-011-distill-selected-ub-mode-practices.md` — the selection, adaptations, and scope boundaries; `skills/boscope/references/automation-tools.md` — the optional method and sample-storage guidance
- Changed: `skills/boscope/SKILL.md` (defect evidence and premise checks in Phase 1, state modeling, terminology and an optional reading pointer in Phase 2, calculation boundaries in Phase 3, behavior tests and repair verification in Phase 4); `skills/README.md` (entry points and reference installation); `book/guidelines/workflow.md` (matching principles); `book/guidelines/README.md` (check count and terminology pointer); `book/guidelines/writing-style.md` (use the existing domain glossary); `book/guidelines/architecture.md` (optional inline glossary guidance); `book/guidelines/coding-style.md` (optional complexity-check configuration)

**Adopter action:** sync the entire `skills/boscope/` directory, `skills/README.md`, and `book/guidelines/{workflow,README,writing-style}.md` per UPGRADE.md, preserving project edits; sync any translated boscope variants and their reference pointers. Do not copy only `SKILL.md` and leave its reference behind. `architecture.md` and `coding-style.md` are project-owned after adoption: do not overwrite them. When useful, offer the glossary and optional complexity-check guidance for manual incorporation into those documents. No new sample directory or mandatory glossary file is required; retained samples follow existing test/fixture conventions.

## 2026-11-06 — phase-2 stop rule aligned, L-tier ADR trigger decidable

The task-tiers replay (ADR-008) caught two leftovers: boscope still required Phase-2 approval while workflow.md, AGENTS.md, and the newer skill variants stop only on real gaps; and the L row's "an ADR when impact warrants" carried no criterion.
Expand Down
3 changes: 2 additions & 1 deletion book/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ description: Master index of the book — the map of every document. Regenerate
- [ADR-008-grade-tasks-into-tiers-before-the-workflow.md](docs/decisions/ADR-008-grade-tasks-into-tiers-before-the-workflow.md) — Tasks are graded S/M/L before any work — S runs a light channel whose only gate is a one-sentence motive, M/L run Step 0 and all six phases; the tier is decided before Step 0 and recorded in the first commit's motive
- [ADR-009-bowrite-voice-on-every-write.md](docs/decisions/ADR-009-bowrite-voice-on-every-write.md) — bowrite's voice rules now run on every write, not just from-scratch drafts; conditions and exceptions join the fidelity contract's never-move list; the writeback path names bowrite explicitly
- [ADR-010-archive-by-status-flip-not-by-moving-files.md](docs/decisions/ADR-010-archive-by-status-flip-not-by-moving-files.md) — task and issue entries archive by flipping a frontmatter status and regenerating the index — files never move, the index regroups with open entries first
- [ADR-011-distill-selected-ub-mode-practices.md](docs/decisions/ADR-011-distill-selected-ub-mode-practices.md) — Selected ub-mode practices supplement project rules for modeling, calculations, testing, defects, terminology, and optional automation
- [README.md](docs/decisions/README.md) — How to write an ADR here — sections, naming, numbering, and when a decision needs a record

### guidelines/
Expand All @@ -80,4 +81,4 @@ description: Master index of the book — the map of every document. Regenerate

- [README.md](plans/README.md) — Plans directory usage — implementation plans land here after Phase 2 approval, with naming and the plan template

<!-- 25 documents -->
<!-- 26 documents -->
36 changes: 36 additions & 0 deletions book/docs/decisions/ADR-011-distill-selected-ub-mode-practices.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
description: Selected ub-mode practices supplement project rules for modeling, calculations, testing, defects, terminology, and optional automation
---

# ADR-011: Distill selected ub-mode practices

## Status

Accepted — 2026-11-06. Ships with the template.

## Context

Robert C. Martin's [ub-mode](https://github.com/unclebob/ub-mode) provides engineering instructions for agents. Its [skill](https://github.com/unclebob/ub-mode/blob/master/SKILL.md) informs the modeling, calculation, testing, defect, terminology, and automation guidance selected here. We adapt those practices to BoCode's scope and document rules.

BoCode already covers small changes, first-principles design, test-first iteration, regression, data ownership, and knowledge writeback. Importing the whole skill would repeat those rules and introduce conflicting process requirements. Short instructions can make modeling, calculation boundaries, test assertions, and defect investigation more concrete. Easily confused business concepts need shared definitions. Worked samples can help develop automation tools, but this specific task should not add checks to ordinary feature work.

## Decision

The ub-mode-derived practices below are supplementary and apply only where useful within the current task. The user's requirements and the project's workflow, task tiers, architecture, and coding conventions take precedence; skip or adapt any conflicting practice. These practices add no phase, approval gate, or required review item. Keep automation guidance in an optional reference, with one task-specific reading pointer in boscope. Keep the current phases, skills, and eleven-item review checklist.

- **Defects:** Phase 1 establishes the cause from reproduction or checkable failure evidence. Where reproduction is unavailable, separate facts from hypotheses and specify verification. If two fixes sharing a premise fail the same verification, state and recheck that premise before another attempt. Phase 4 checks the original failure and regression; hiding an error alone is insufficient.
- **Modeling and calculations:** where practical, Phase 2 represents valid state combinations in types or data structures, and Phase 3 keeps business calculations as pure functions with explicit inputs and outputs, separate from external reads and writes. Existing scope rules still prohibit unrelated abstractions or refactors.
- **Tests:** Phase 4 checks observable results and required side effects through the caller's interface, without tying tests to private call sequences.
- **Complexity:** use the existing complexity review to consider complex conditions, deep nesting, and repeated branches when relevant. Reuse configured lint/static-analysis checks where available; adopting projects choose thresholds and warning or blocking policy. Scores identify candidates for review, not automatic refactoring. No measurement suite is required.
- **Automation tools (optional):** `skills/boscope/references/automation-tools.md` describes worked samples for batch or repetitive tasks. Use a sample when processing rules, expected results, or batch effects need confirmation; existing tools and established rules may already provide enough evidence. The agent can produce it from the requirements, clarifying unresolved business rules. It need not be a test or file. Retained regression cases follow the owning tests' conventions. Ordinary tasks do not load this reference or evaluate an automation checklist item.
- **Domain terms:** when concepts need clarification or terms are used inconsistently, maintain concise meanings, code names, and distinctions in the existing architecture document. Use existing definitions across docs, interfaces, and code; split the glossary only when it grows. This does not authorize unrelated renames.

Context-management and action-log requirements are excluded by user choice. Boundary-only validation is not introduced; existing input, authorization, and business checks remain necessary. Existing data-ownership rules stay as they are. Companion metrics tools, fixed thresholds, worktree cleanup, and upstream commit/push instructions remain outside this change. Phase 5/6 still record findings without fixing them.

## Consequences

- Defect repairs have evidence to review; terminology has a shared definition when needed; tool-development tasks can consult the sample method without burdening the general workflow.
- No new skill, sample directory, mandatory glossary file, or tool dependency is introduced. Complexity review adds no mandatory Python runtime, custom analyzer, or fixed score threshold. New tooling remains within the designed scope.
- The glossary guidance lives in the skill as well as the architecture template: adopters own their architecture documents, so upgrades offer this addition for manual incorporation rather than overwriting project content.
- The existing eleven-item review checklist is unchanged. The skills README and root changelog explain that boscope's reference is copied with its entry point, and list the optional architecture-template addition. This template's own records remain ADRs, per [ADR-004](ADR-004-template-free-of-instance-records.md).
- Verification exposed an existing portability issue: on a Windows CRLF checkout, the index generator misreads descriptions and emits backslash paths. Rebuild with the unchanged generator on an LF copy under Linux; fixing the generator is separate work.
2 changes: 1 addition & 1 deletion book/guidelines/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The project's development rules. Every contributor — including AI agents — f
|--------|-----------|
| Phases, gates, book sync | `workflow.md` |
| Grading a task, which channel it runs | `task-tiers.md` |
| Module boundaries, data ownership, tech swaps | `architecture.md` |
| Module boundaries, data ownership, tech swaps, domain terms | `architecture.md` |
| The current shape of modules and data flow | `../docs/architecture/` snapshots |
| Interface contracts | `../docs/api/` |
| Writing any book document | `writing-style.md` |
Expand Down
1 change: 1 addition & 0 deletions book/guidelines/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description: Template for your project's long-term architecture rules — bounda
2. **Module map** — the top-level modules/processes, their responsibilities, and who talks to whom. One sentence per module is enough; details live in snapshots.
3. **Technology baseline** — languages, frameworks, storage, and the rule for swapping any of them (usually: via an adapter, never via a rewrite).
4. **Data ownership** — for each store or dataset, the single module allowed to write it.
5. **Domain terms (when needed)** — when concepts need clarification or terms are used inconsistently, keep a short glossary here: each term's meaning, code name, and distinction from similar concepts. Reuse existing definitions across docs, interfaces, and code; split the glossary into a linked document only when it grows. Terminology work stays within the task's scope.

## Worked example: boundary invariants

Expand Down
1 change: 1 addition & 0 deletions book/guidelines/coding-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ description: Template for your project's coding baseline — the language-specif
- **Language & toolchain** — versions, runtime, package manager; what counts as "the standard way to run this project"
- **Naming** — files, types, functions, variables, constants; the project's one convention per kind
- **Formatting & lint** — the tool, the command, and that CI fails when it's dirty
- **Complexity checks (optional)** — reuse existing lint/static analysis; define the command, scope, project-specific thresholds, and whether findings warn or block. Scores guide review; do not split code mechanically to lower them
- **Error handling** — how errors are raised, wrapped, and surfaced; what never gets swallowed
- **Testing conventions** — where tests live, how they're named, what must be covered before a change counts as done
- **Dependencies** — the policy for adding one (and the default answer: don't, unless it removes more code than it adds)
Expand Down
10 changes: 10 additions & 0 deletions book/guidelines/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ description: Six-phase gate workflow with the eight code↔book interaction rule

Grade the task first — S, M, or L per `task-tiers.md`; the tier is decided before any work and lands in the first commit's motive. S runs the light channel and never enters this table. Every M/L feature moves through these phases in order. **No skipping.**

The ub-mode-derived practices below are supplementary and apply only where useful within the current task. The user's requirements and the project's workflow, task tiers, architecture, and coding conventions take precedence; skip or adapt any conflicting practice. These practices add no phase, approval gate, or required review item.

| Phase | Name | Output | Gate |
|------|------|--------|------|
| Step 0 | Structured requirements brief | Requirements brief | Every slot filled |
Expand All @@ -20,10 +22,18 @@ Grade the task first — S, M, or L per `task-tiers.md`; the tier is decided bef

Step 0 comes before any code (M and L). Fill the brief: background, scope (what it affects, what it explicitly does **not** affect, and the boundaries), and the requirement itself. An empty "does not affect" list is the number-one cause of out-of-scope changes in Phase 3 — the exclusions slot is required. Requirements arrive as suggestions; physics is the only law — correctness, data integrity, and the user's explicit hard constraints don't negotiate, while convention, past practice, and "how it's done" do. Question the inherited HOW; the user's WHAT holds (reasoning and sources in ADR-005, in the BoCode repository's `book/docs/decisions/`). The stated request is a proxy — the experience behind it is the requirement: capture what the user will see, do, and get. Focus is saying no; the exclusions slot gives the feature its shape (ADR-006).

For defect work, Phase 1 reproduces the failure or gathers checkable failure evidence and locates the cause before code changes. If reproduction is unavailable, distinguish facts from hypotheses and state how the fix will be verified. Suppressing an error alone does not establish a repair. If two fixes sharing a premise fail the same verification, state and recheck that premise before trying another fix (ADR-011).

Phase 2 produces the full design — data flow, file list, interfaces — and proceeds; it stops for the user only when a real gap appears (scope conflict, undetermined data shape, unclear external dependency), never just for confirmation. Designs and estimates derive bottom-up from primitives — what the data and code actually are — never by analogy to last time; delete what no requirement calls for before optimizing anything that remains. Design is how it works — the surfaces the user touches (defaults, empty states, error messages) are designed with the data flow, never decorated after it (ADR-006).

When domain concepts need clarification or terms are used inconsistently, maintain a short glossary in the existing architecture document, with meanings, code names, and distinctions; split it only when it grows. Use those terms consistently across docs, interfaces, and code (ADR-011).

Where practical, Phase 2 uses types or data structures to exclude invalid state combinations. Phase 3 keeps business calculations as pure functions with explicit inputs and outputs, separate from database, file, and network operations (ADR-011).

Phase 4's hard part is the gate, not the sequence: all relevant tests green, no assertion weakened to get there, coverage of the normal path, boundary inputs (ranges, empty, extremes), error paths, and a regression check that existing behavior didn't break. Test-first (write a failing test → minimum implementation → refactor staying green) is the default loop — sequence the work however keeps the gate honest. Iterate fast inside the phase; polish at the gate — what crosses a gate is finished: defaults chosen, errors worded, edges handled (ADR-006).

Phase 4 tests observable results and required side effects through the caller's interface, avoiding dependence on private call sequences. For defects, it verifies that the original failure is resolved and existing behavior holds; unverified outcomes remain explicit (ADR-011).

Phases 5 and 6 share one discipline: **record, never fix.** A problem found during review or wrap-up goes into `notes/issue/` — fixing it is a separate, later task. Fixing in passing feels efficient and destroys the gate: the review no longer reviews what was built.

## code ↔ book — the two halves
Expand Down
1 change: 1 addition & 0 deletions book/guidelines/writing-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Work by pattern, not word-for-word substitution. Rotating synonyms to dodge repe
- Un-nominalize: "performed an optimization" → what changed, how much faster. "perform / implement / complete + gerund" is the tell
- Shorten translationese: fewer long attributive chains, fewer passive piles, less "through X, by way of Y, to achieve Z"
- Don't call the same thing by three different names in adjacent sentences
- Use the project's domain glossary, when present, as the source for business terms; preserve the distinctions between similar concepts
- Filler intensifiers ("important", "key", "critical", "core"): trim only when density is clearly too high, or replace with concrete information

## Intensity levels
Expand Down
4 changes: 2 additions & 2 deletions skills/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Skills

Four self-contained skills implement the BoCode workflow for AI agents. Each is a single `SKILL.md` in the standard format (frontmatter with `name` and `description`, then the body) — no code, no dependencies.
Four skills implement the BoCode workflow for AI agents. Each has a `SKILL.md` entry point in the standard format (frontmatter with `name` and `description`, then the body) — no code, no dependencies. A skill can include optional references: boscope's [automation tools guide](boscope/references/automation-tools.md) is read only when relevant, not as a separate skill.

| Skill | Does | Triggers |
|-------|------|----------|
Expand All @@ -13,7 +13,7 @@ Division of labor: **skills say when and how** (executable behavior for the agen

## Installation

Copy the four skill directories into your agent's skills folder:
Copy the four skill directories, including any `references/` subdirectories, into your agent's skills folder:

- **ZCode**: `~/.zcode/skills/` (user-wide) or `<project>/.zcode/skills/` (per project)
- **Claude Code**: `~/.claude/skills/` or `<project>/.claude/skills/`
Expand Down
Loading