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
36 changes: 36 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!-- Style rules: docs/PR_STYLE.md. Delete any section that adds nothing. -->

## Purpose

<!-- 2 to 4 sentences: the problem, then what this PR does. -->

## How it works

<!-- Mermaid diagram for flows. `text` file tree for new or changed files. -->

```text
path/
└── file.py # new: what it does
```

## Changes

<!-- Numbered, grouped by area. Each item: what, Effect:, Before:. -->

1. **What changed.**
Effect: what is different now.
Before: what happened before.

## Usage

```bash
# exact commands or config
```

## Verification

<!-- Real commands and real numbers. Never invented. -->

## Notes

<!-- Merge order, dependencies on other PRs, what is not done, decisions for the reviewer. -->
49 changes: 49 additions & 0 deletions docs/CODE_DESIGN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Code design

These rules decide where code goes and how much code a change adds. They come from code review. `docs/PR_STYLE.md` gives the rules for PR text.

## Put code where its concern lives

- Group code by domain, not by workflow step. A package called after a pipeline stage (for example `verify/`) with unrelated modules inside it is not a design.
- Extend the package that already has the concern before you add a new one:
- images and containers go in `docker/`;
- task rendering and `task.toml` go in `harbor_adapter/`;
- LLM calls and prompt extraction go in `agents/`;
- pipeline steps go in `runners/`;
- pushing data to a registry or dataset goes in `publish/`.
- Add a top-level package only for a new domain with several modules, for example `measurement/` for timing, the noise rule and the measure gate.
- Keep code that runs in different places apart:
- code that runs inside a task container goes with the templates;
- long-running host services go in their own module;
- the library holds the logic;
- the CLI only parses arguments and calls the library.

## Change the source, not the output

- Fix behavior where it starts. If new tasks need a different prompt, render it that way: add a runner class (for example `RenderShortProblemsRunner`) and make it the default. Do not add a tool that edits rendered files after the fact.
- Extend the existing patterns (a runner subclass, a publisher next to the other publishers) instead of a parallel copy.
- Before you add a step, check whether the existing pipeline already does it. For example, publishing is a step of `fc-data`.

## Write less code

- Apply the ponytail rules (https://github.com/DietrichGebert/ponytail/blob/main/skills/ponytail/SKILL.md) to every component: the smallest change that fully solves the task, deletion before addition, no option or layer that nobody asked for.
- Before you write a helper, check in this order:
1. this repository;
2. the standard library;
3. an installed dependency;
4. a maintained external package.
- Generic helpers (JSONL files, shell calls, free disk space) are not main modules. Put them in `utils/` or in the module that uses them.
- One-off scripts (reports, counts, operational runs) are not library code. Put them in `scripts/`, or in the repository that uses them, or delete them after use.
- Archive old code and documents when nothing uses them. Do not keep them for history; git keeps the history.

## Make it work on every host

- A service or script must not depend on one machine: no fixed home paths, host names or local mounts. It must run the same way on an AWS host as on the local machine.
- Settings come from arguments or environment variables with clear names, documented in the module that uses them.

## Review checklist

- Does each new module belong to the package that holds its concern?
- Is any new module a utility, a one-off script or a duplicate of something that exists?
- Does the change fix the source of the behavior, or edit its output?
- Can a smaller change do the same job?
53 changes: 53 additions & 0 deletions docs/PR_STYLE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# PR style

The PR template (`.github/pull_request_template.md`) gives the sections. This page gives the rules for PR text. `docs/CODE_DESIGN.md` gives the rules for the code.

## Language

- Use ASD-STE100 Simplified Technical English.
- Use short active sentences in the present tense: 20 words maximum for steps, 25 for other text.
- Write one instruction per sentence. Use simple words. Do not use idioms or needless hyphens.
- A reader must understand the PR in 30 seconds.
- Do not use these words: "contract", "fail loud", "fail closed", "straddle", "owns", "surface", "guard", "load-bearing", "robust", "seamless", "footgun". Say what the code does.
- Do not write host names. Write "training node", "inference node", "this machine" or "the second machine".
- Do not write secrets. Write credentials only as `${VAR}`.

## Sections, in this order

Delete a section if it adds nothing.

1. **Purpose**: 2 to 4 sentences. The problem, then what the PR does.
2. **How it works**: a Mermaid diagram for flows. A `text` file tree for new or changed files. The Mermaid must parse.
3. **Changes**: a numbered list, grouped by area. Each item gives what changed, `Effect:` and `Before:`.
4. **Usage**: a code block with the exact commands or config.
5. **Verification**: the real commands and the real numbers. Never invent numbers.
6. **Notes**: merge order, dependencies on other PRs, what is not done, decisions for the reviewer.

Write math as GitHub math: `$…$` inline and `$$…$$` for display.

Do not add a footer or any AI attribution.

## Code in the PR

- Use the minimum number of lines.
- Comments: 1 or 2 lines. Say what the code does and why. No narrative.
- Write one test for each real behavior.
- Do not add co-author or session trailers to commits.

## Example

````markdown
## Purpose

The reward counts a timeout as a failure. A slow task then gets a negative reward. This PR gives a timeout a reward of 0.

## Changes

1. **Timeout reward is 0.**
Effect: a timed out trial does not push the policy away from the task.
Before: a timeout got the failure penalty $-1.25$.

## Verification

`pytest tests/test_reward.py`: 14 passed.
````
Loading