|
| 1 | +# Guidance for AI agents, bots, and humans contributing to Chronicle Software's OpenHFT projects. |
| 2 | + |
| 3 | +LLM-based agents can accelerate development only if they respect our house rules. This file tells you: |
| 4 | + |
| 5 | +* how to run and verify the build; |
| 6 | +* what *not* to comment; |
| 7 | +* when to open pull requests. |
| 8 | + |
| 9 | +## Language & character-set policy |
| 10 | + |
| 11 | +| Requirement | Rationale | |
| 12 | +|--------------|-----------| |
| 13 | +| **British English** spelling (`organisation`, `licence`, *not* `organization`, `license`) except technical US spellings like `synchronized` | Keeps wording consistent with Chronicle's London HQ and existing docs. See the University of Oxford style guide for reference. | |
| 14 | +| **ASCII-7 only** (code-points 0-127). Avoid smart quotes, non-breaking spaces and accented characters. | ASCII-7 survives every toolchain Chronicle uses, incl. low-latency binary wire formats that expect the 8th bit to be 0. | |
| 15 | +| If a symbol is not available in ASCII-7, use a textual form such as `micro-second`, `>=`, `:alpha:`, `:yes:`. This is the preferred approach and Unicode must not be inserted. | Extended or '8-bit ASCII' variants are *not* portable and are therefore disallowed. | |
| 16 | + |
| 17 | +## Javadoc guidelines |
| 18 | + |
| 19 | +**Goal:** Every Javadoc block should add information you cannot glean from the method signature alone. Anything else is |
| 20 | +noise and slows readers down. |
| 21 | + |
| 22 | +| Do | Don’t | |
| 23 | +|----|-------| |
| 24 | +| State *behavioural contracts*, edge-cases, thread-safety guarantees, units, performance characteristics and checked exceptions. | Restate the obvious ("Gets the value", "Sets the name"). | |
| 25 | +| Keep the first sentence short; it becomes the summary line in aggregated docs. | Duplicate parameter names/ types unless more explanation is needed. | |
| 26 | +| Prefer `@param` for *constraints* and `@throws` for *conditions*, following Oracle’s style guide. | Pad comments to reach a line-length target. | |
| 27 | +| Remove or rewrite autogenerated Javadoc for trivial getters/setters. | Leave stale comments that now contradict the code. | |
| 28 | + |
| 29 | +The principle that Javadoc should only explain what is *not* manifest from the signature is well-established in the |
| 30 | +wider Java community. |
| 31 | + |
| 32 | +## Build & test commands |
| 33 | + |
| 34 | +Agents must verify that the project still compiles and all unit tests pass before opening a PR: |
| 35 | + |
| 36 | +```bash |
| 37 | +# From repo root |
| 38 | +mvn -q verify |
| 39 | +``` |
| 40 | + |
| 41 | +## Commit-message & PR etiquette |
| 42 | + |
| 43 | +1. **Subject line <= 72 chars**, imperative mood: "Fix roll-cycle offset in `ExcerptAppender`". |
| 44 | +2. Reference the JIRA/GitHub issue if it exists. |
| 45 | +3. In *body*: *root cause -> fix -> measurable impact* (latency, allocation, etc.). Use ASCII bullet points. |
| 46 | +4. **Run `mvn verify`** again after rebasing. |
| 47 | + |
| 48 | +## What to ask the reviewers |
| 49 | + |
| 50 | +* *Is this AsciiDoc documentation precise enough for a clean-room re-implementation?* |
| 51 | +* Does the Javadoc explain the code's *why* and *how* that a junior developer would not be expected to work out? |
| 52 | +* Are the documentation, tests and code updated together so the change is clear? |
| 53 | +* Does the commit point back to the relevant requirement or decision tag? |
| 54 | +* Would an example or small diagram help future maintainers? |
| 55 | + |
| 56 | +## Project requirements |
| 57 | + |
| 58 | +See the [Decision Log](src/main/adoc/decision-log.adoc) for the latest project decisions. |
| 59 | +See the [Project Requirements](src/main/adoc/project-requirements.adoc) for details on project requirements. |
| 60 | + |
| 61 | +## Elevating the Workflow with Real-Time Documentation |
| 62 | + |
| 63 | +Building upon our existing Iterative Workflow, the newest recommendation is to emphasise *real-time updates* to documentation. |
| 64 | +Ensure the relevant `.adoc` files are updated when features, requirements, implementation details, or tests change. |
| 65 | +This tight loop informs the AI accurately and creates immediate clarity for all team members. |
| 66 | + |
| 67 | +### Benefits of Real-Time Documentation |
| 68 | + |
| 69 | +* **Confidence in documentation**: Accurate docs prevent miscommunications that derail real-world outcomes. |
| 70 | +* **Reduced drift**: Real-time updates keep requirements, tests and code aligned. |
| 71 | +* **Faster feedback**: AI can quickly highlight inconsistencies when everything is in sync. |
| 72 | +* **Better quality**: Frequent checks align the implementation with the specified behaviour. |
| 73 | +* **Smoother onboarding**: Up-to-date AsciiDoc clarifies the system for new developers. |
| 74 | +* **Incremental changes**: AIDE flags newly updated files so you can keep the documentation synchronised. |
| 75 | + |
| 76 | +### Best Practices |
| 77 | + |
| 78 | +* **Maintain Sync**: Keep documentation (AsciiDoc), tests, and code synchronised in version control. Changes in one area should prompt reviews and potential updates in the others. |
| 79 | +* **Doc-First for New Work**: For *new* features or requirements, aim to update documentation first, then use AI to help produce or refine corresponding code and tests. For refactoring or initial bootstrapping, updates might flow from code/tests back to documentation, which should then be reviewed and finalised. |
| 80 | +* **Small Commits**: Each commit should ideally relate to a single requirement or coherent change, making reviews easier for humans and AI analysis tools. |
| 81 | +- **Team Buy-In**: Encourage everyone to review AI outputs critically and contribute to maintaining the synchronicity of all artefacts. |
| 82 | + |
| 83 | +## AI Agent Guidelines |
| 84 | + |
| 85 | +When using AI agents to assist with development, please adhere to the following guidelines: |
| 86 | + |
| 87 | +* **Respect the Language & Character-set Policy**: Ensure all AI-generated content follows the British English and ASCII-7 guidelines outlined above. |
| 88 | +Focus on Clarity: AI-generated documentation should be clear and concise and add value beyond what is already present in the code or existing documentation. |
| 89 | +* **Avoid Redundancy**: Do not generate content that duplicates existing documentation or code comments unless it provides additional context or clarification. |
| 90 | +* **Review AI Outputs**: Always review AI-generated content for accuracy, relevance, and adherence to the project's documentation standards before committing it to the repository. |
| 91 | + |
| 92 | +## Company-Wide Tagging |
| 93 | + |
| 94 | +This section records **company-wide** decisions that apply to *all* Chronicle projects. All identifiers use the <Scope>-<Tag>-xxx prefix. The `xxx` are unique across in the same Scope even if the tags are different. Component-specific decisions live in their xxx-decision-log.adoc files. |
| 95 | + |
| 96 | +### Tag Taxonomy (Nine-Box Framework) |
| 97 | + |
| 98 | +To improve traceability, we adopt the Nine-Box taxonomy for requirement and decision identifiers. These tags are used in addition to the existing ALL prefix, which remains reserved for global decisions across every project. |
| 99 | + |
| 100 | +.Adopt a Nine-Box Requirement Taxonomy |
| 101 | + |
| 102 | +|Tag | Scope | Typical examples | |
| 103 | +|----|-------|------------------| |
| 104 | +|FN |Functional user-visible behaviour | Message routing, business rules | |
| 105 | +|NF-P |Non-functional - Performance | Latency budgets, throughput targets | |
| 106 | +|NF-S |Non-functional - Security | Authentication method, TLS version | |
| 107 | +|NF-O |Non-functional - Operability | Logging, monitoring, health checks | |
| 108 | +|TEST |Test / QA obligations | Chaos scenarios, benchmarking rigs | |
| 109 | +|DOC |Documentation obligations | Sequence diagrams, user guides | |
| 110 | +|OPS |Operational / DevOps concerns | Helm values, deployment checklist | |
| 111 | +|UX |Operator or end-user experience | CLI ergonomics, dashboard layouts | |
| 112 | +|RISK |Compliance / risk controls | GDPR retention, audit trail | |
| 113 | + |
| 114 | +`ALL-*` stays global, case-exact tags. Pick one primary tag if multiple apply. |
| 115 | + |
| 116 | +### Decision Record Template |
| 117 | + |
| 118 | +```asciidoc |
| 119 | +=== [Identifier] Title of Decision |
| 120 | + |
| 121 | +- Date: YYYY-MM-DD |
| 122 | +- Context: |
| 123 | +* What is the issue that this decision addresses? |
| 124 | +* What are the driving forces, constraints, and requirements? |
| 125 | +- Decision Statement: |
| 126 | +* What is the change that is being proposed or was decided? |
| 127 | +- **Alternatives Considered:** |
| 128 | +* [Alternative 1 Name/Type]: |
| 129 | +** *Description:* Brief description of the alternative. |
| 130 | +** *Pros:* ... |
| 131 | +** *Cons:* ... |
| 132 | +* [Alternative 2 Name/Type]: |
| 133 | +** *Description:* Brief description of the alternative. |
| 134 | +** *Pros:* ... |
| 135 | +** *Cons:* ... |
| 136 | +- **Rationale for Decision:** |
| 137 | +* Why was the chosen decision selected? |
| 138 | +* How does it address the context and outweigh the cons of alternatives? |
| 139 | +- **Impact & Consequences:** |
| 140 | +* What are the positive and negative consequences of this decision? |
| 141 | +* How does this decision affect the system, developers, users, or operations? |
| 142 | +- What are the trade-offs made? |
| 143 | +- **Notes/Links:** |
| 144 | +** (Optional: Links to relevant issues, discussions, documentation, proof-of-concepts) |
| 145 | +``` |
| 146 | +
|
| 147 | +## Asciidoc formatting guidelines |
| 148 | + |
| 149 | +### List Indentation |
| 150 | + |
| 151 | +Do not rely on indentation for list items in AsciiDoc documents. Use the following pattern instead: |
| 152 | + |
| 153 | +```asciidoc |
| 154 | +- top level |
| 155 | +* second level |
| 156 | + ** third level |
| 157 | +``` |
| 158 | + |
| 159 | +### Emphasis and Bold Text |
| 160 | + |
| 161 | +In AsciiDoc, an underscore `_` is _emphasis_; `*text*` is *bold*. |
0 commit comments