CONCEPTS · SPECIFICATION · USAGE
Docs
Core concepts (distance from common sense, deciding what to keep vs. remove, and three-perspective dialogue), glossary, .codenju-context format, and editorial policy.
How it works
You neither fix everything blindly nor keep everything forever. Use distance from common standards to verify the reason—then decide what to fix/remove, what to keep with conditions, and what to protect.
- 01
Compare with common references
Compare against GoF patterns, Clean Architecture, and requirement-fit references to surface deviations. AI and codenju scan assist the initial pass.
- 02
Sort into three buckets
Separate (1) accidents & retired clutter to fix or remove, (2) choices made under constraints to keep with conditions, and (3) company strengths or industry rules to protect.
- 03
Reply in one line across roles
Only people know the real reason. Engineering, management, and leadership reply with Correct, Agree, or Supplement.
- 04
Approve what stays—and retire what does not
Record constraint → decision → outcome with premises and review dates for what stays. Remove what no longer has a reason. Agreement is not approval.
Glossary
- Deviation
- Distance across three layers: 1. General standards → 2. Industry norms → 3. Company ways. Used as a radar to start dialogue—not a grade. Sorts into fix/remove, keep with industry rules or conditions, or protect first as a company strength.
- Industry norm / constrained deviation
- Commercial conventions, domain wording rules (such as rephrasing compliance-flagged terms in finance), or capped choices (e.g. an N+1 capped at 10 rows). Recorded with premises and review dates.
- Revenue-driving company strength
- Dedicated in-house calculation libraries and deep domain logic that earn revenue and differentiate your company. Recorded with reasons and boundaries so generic refactoring does not erase your edge.
- Three perspectives (Engineering / Management / Leadership)
- Looking at one code or rule observation from authors, operations/PM, and business owners together.
- Decision record (precedent)
- A short constraint → decision → outcome note. A reference for the next call rather than a rigid law (“precedent” is sometimes used as a brand term).
- Background
- Context behind a decision that never made it into code or specs.
- General answer / here
- Two-axis scores (0–10). General answer = closeness to textbook engineering standards; here = acceptance in this organization.
- Conflict labels C-1–C-5
- Types of trade-off (DRY vs coupling, YAGNI vs extensibility, etc.).
- Atlas
- Browsable face of the public reference list (definitions). Real code notes live on Context.
- definitions
- Versioned public reference list (YAML) browsed on /atlas.
- .codenju-context
- Portable YAML notes stored inside a repository.
- JCO
- Judgment Certificate of Origin—attestation that a human verified the judgment.
Atlas and definitions
Atlas browses the public reference list (definitions)—textbook engineering practices such as GoF patterns and Clean Architecture paired with acceptance conditions. Because textbook guidance itself can age as languages and practices evolve, every entry carries a Knowledge Status (Living / Evolved / Fossilized / Deprecated) and a review date. Real code annotations live on Context.
Browse reference list →Relation to SonarQube
Why Sonar scaled
“Quality” is an instant noun. Clean as You Code gates new code only. Bottom-up adoption (IDE→PR→CI) and visible issue lists made scoring understandable at a glance.
The gap that remains
Scoring cannot tell why code differs—or whether it is clutter you can safely delete or a business strength you must protect. codenju fills that gap through human dialogue.
.codenju-context spec
Portable YAML format (.codenju-context.yaml) for keeping decision records right inside a repo. Story fields constraint / decision / consequence are required. AGENTS.md / CLAUDE.md / .cursor/rules are optional export targets (AI not required).
specVersion: "0.2.0"
project: order-management-system
repo: acme/order-management-system
definitionsVersion: defs-2026.09.1
annotations:
- id: ann-0001
target: { repo: acme/oms, commit: a1b2c3d, path: src/Foo.java }
title: Rounding per tax bulletin via switch (not Strategy)
story:
constraint: Invoice rounding rules fixed by regulation
decision: switch on process ID instead of Strategy abstraction
consequence: OCP violation but audit reconciliation cost cut by 2/3
scores: { global: 4, corporate: 9 }
conflicts: [C-4]
review_date: 2027-01-15Full spec and JSON Schema: to be distributed via the upcoming spec/ repository.
CLI
codenju-cli (MIT / single Go binary) is an on-machine helper. It writes definition matches to .codenju-context.yaml (scan) and exports to AGENTS.md, CLAUDE.md, or .cursor/rules (export). Humans write decision records; scan never overwrites them.
# Build cd cli && go build -o codenju ./cmd/codenju # Scan → .codenju-context.yaml (references matched from definitions) codenju scan --definitions ../definitions # Precedents are written by humans in .codenju-context.yaml (annotations) # Export (updates only the codenju block; hand-written content is kept) codenju export --format claude # → CLAUDE.md codenju export --format cursor # → .cursor/rules/codenju-context.mdc # Pin / check definition feed codenju defs status codenju defs pin --version defs-2026.09.1
Editorial policy (public reference list)
- Proposal-first: no direct PRs to definitions—propose via Issue/Discussion, then PR after approval.
- JCO (Judgment Certificate of Origin): attest human verification on PRs; disclose AI involvement.
- Reference model: decision records rather than rigid laws. Every entry carries a review_date.
- License: public reference list CC BY-ND 4.0. Org overlays can be created freely in a separate namespace.