nemotron-add-pattern
Invocation: /nemotron-add-pattern.
You help contributors add a new cross-cutting pattern to src/nemotron/steps/patterns/ without getting the frontmatter, scope, catalog regeneration, or tests wrong.
Tone
Concise. Checklist-first. Ask for missing facts before writing files.
- Status updates: ≤2 lines
- Prefer bullets over long prose
- Say exactly which pattern file you will create and which commands you will run
- Do not guess step ids or confidence level
- Keep the recommendation actionable, not academic
- Always regenerate
PATTERNS.md and run tests
Workflow
Four phases. Always in this order.
1. Orient
Read these first:
src/nemotron/steps/patterns/sft-small-dataset-prefer-lora.md
src/nemotron/steps/PATTERNS.md
src/nemotron/steps/index.py
tests/steps/test_patterns.py
Then ask the contributor:
- What is the pattern about? (one sentence)
- When should it apply? (natural-language triggers)
- Which steps does it touch? (step ids, or
[] for global)
- What is the confidence level? (
high, medium, or experimental)
- Does it introduce a new concept or just encode existing tribal knowledge?
Use these repo conventions:
- Pattern files live at
src/nemotron/steps/patterns/{id}.md.
- The filename stem must match the frontmatter
id.
- Required frontmatter fields are
id, title, tags, triggers, steps, and confidence.
steps: [] is valid for a global pattern.
- Valid confidence values are
high, medium, and experimental.
- The body uses these sections:
## When to apply, ## What to do, ## Exceptions, ## References.
- Step-strategy cross-links in
step.toml are a separate task. Do not edit them here.
2. Generate
Create:
src/nemotron/steps/patterns/{id}.md
The pattern file must contain:
- YAML frontmatter with
id, title, tags, triggers, steps, confidence
## When to apply
## What to do
## Exceptions
## References
Generation rules:
- Keep the pattern id kebab-case and make it match the filename exactly.
- Turn vague triggers into 2–4 concrete, observable conditions.
- Scope the pattern honestly: use explicit step ids if it only applies to a subset of steps; use
[] only when it is truly global.
- Put the recommendation itself in
What to do; keep background explanation shorter than the action guidance.
- If the pattern introduces a new concept, define it in the first paragraph of
When to apply.
- Do not modify existing patterns.
- Regenerate the catalog with:
uv run python src/nemotron/steps/index.py
- Run validations with:
uv run pytest tests/steps -q
3. Validate
Check all of these before finishing:
- Frontmatter has all required fields
- The pattern id matches the filename
steps contains only valid step ids
confidence is one of high, medium, experimental
src/nemotron/steps/PATTERNS.md is updated
uv run pytest tests/steps -q passes
If validation fails:
- Fix the real frontmatter, scope, or catalog issue
- Re-run the failing command
- Do not present the result until tests pass
4. Summarize
Show:
- What pattern was created
- The file added
- The final scope (
steps list or global)
- The confidence level
- That
PATTERNS.md was regenerated
- That
uv run pytest tests/steps -q passed
Boundaries
Do
- Reuse the live pattern format from
small-dataset-lora.md
- Keep triggers concrete
- Keep advice prescriptive and easy to apply
- Regenerate
PATTERNS.md
- Run tests every time
Don’t
- Don’t modify existing patterns
- Don’t modify
step.toml strategy blocks here
- Don’t invent step ids
- Don’t label a new idea
high confidence without evidence
- Don’t stop before tests pass
When Stuck
- If the step scope is unclear, look at
src/nemotron/steps/STEPS.md and ask which ids the contributor actually wants.
- If the trigger is vague, rewrite it as an observable condition before writing the file.
- If the concept is still experimental, mark it
experimental rather than overstating certainty.
- If the pattern overlaps an existing one, explain the overlap and ask whether this should be a separate pattern.
- After two failed validation loops, stop and report the exact failing command and error.
Calibration Examples
Example 1 — simple high-confidence pattern
User:
Add a pattern saying we should use a consistent random seed across stages.
Assistant:
I’ll confirm whether this is global or limited to a few steps, then I’ll create src/nemotron/steps/patterns/consistent-random-seed.md with the required frontmatter and the four body sections.
I’ll mark it high confidence only if the guidance is already established team practice, regenerate PATTERNS.md with uv run python src/nemotron/steps/index.py, and run uv run pytest tests/steps -q before I finish.
Example 2 — experimental step-scoped pattern
User:
Add a pattern for code-generation SFT that uses a higher learning rate.
Assistant:
I’ll confirm the exact step ids and keep the scope narrow, for example sft/automodel and sft/megatron_bridge if that is what you intend.
Because this is a newer idea rather than settled guidance, I’ll label it experimental, encode the trigger conditions in frontmatter, create the new pattern markdown file, regenerate PATTERNS.md, and run uv run pytest tests/steps -q.
1---2name: nemotron-add-pattern3description: Add a cross-cutting decision pattern under src/nemotron/steps/patterns/. Use when a recurring ML decision (tokenizer lock, eval bookends, LoRA-on-small-data, etc.) must be encoded so other skills can fire it during planning.4---56# nemotron-add-pattern78Invocation: `/nemotron-add-pattern`.910You help contributors add a new cross-cutting pattern to `src/nemotron/steps/patterns/` without getting the frontmatter, scope, catalog regeneration, or tests wrong.1112## Tone1314Concise. Checklist-first. Ask for missing facts before writing files.1516- Status updates: ≤2 lines17- Prefer bullets over long prose18- Say exactly which pattern file you will create and which commands you will run19- Do not guess step ids or confidence level20- Keep the recommendation actionable, not academic21- Always regenerate `PATTERNS.md` and run tests2223---2425## Workflow2627Four phases. Always in this order.2829### 1. Orient3031Read these first:32- `src/nemotron/steps/patterns/sft-small-dataset-prefer-lora.md`33- `src/nemotron/steps/PATTERNS.md`34- `src/nemotron/steps/index.py`35- `tests/steps/test_patterns.py`3637Then ask the contributor:381. What is the pattern about? (one sentence)392. When should it apply? (natural-language triggers)403. Which steps does it touch? (step ids, or `[]` for global)414. What is the confidence level? (`high`, `medium`, or `experimental`)425. Does it introduce a new concept or just encode existing tribal knowledge?4344Use these repo conventions:45- Pattern files live at `src/nemotron/steps/patterns/{id}.md`.46- The filename stem must match the frontmatter `id`.47- Required frontmatter fields are `id`, `title`, `tags`, `triggers`, `steps`, and `confidence`.48- `steps: []` is valid for a global pattern.49- Valid confidence values are `high`, `medium`, and `experimental`.50- The body uses these sections: `## When to apply`, `## What to do`, `## Exceptions`, `## References`.51- Step-strategy cross-links in `step.toml` are a separate task. Do not edit them here.5253### 2. Generate5455Create:56- `src/nemotron/steps/patterns/{id}.md`5758The pattern file must contain:59- YAML frontmatter with `id`, `title`, `tags`, `triggers`, `steps`, `confidence`60- `## When to apply`61- `## What to do`62- `## Exceptions`63- `## References`6465Generation rules:661. Keep the pattern id kebab-case and make it match the filename exactly.672. Turn vague triggers into 2–4 concrete, observable conditions.683. Scope the pattern honestly: use explicit step ids if it only applies to a subset of steps; use `[]` only when it is truly global.694. Put the recommendation itself in `What to do`; keep background explanation shorter than the action guidance.705. If the pattern introduces a new concept, define it in the first paragraph of `When to apply`.716. Do not modify existing patterns.727. Regenerate the catalog with:73 - `uv run python src/nemotron/steps/index.py`748. Run validations with:75 - `uv run pytest tests/steps -q`7677### 3. Validate7879Check all of these before finishing:80- Frontmatter has all required fields81- The pattern id matches the filename82- `steps` contains only valid step ids83- `confidence` is one of `high`, `medium`, `experimental`84- `src/nemotron/steps/PATTERNS.md` is updated85- `uv run pytest tests/steps -q` passes8687If validation fails:881. Fix the real frontmatter, scope, or catalog issue892. Re-run the failing command903. Do not present the result until tests pass9192### 4. Summarize9394Show:95- What pattern was created96- The file added97- The final scope (`steps` list or global)98- The confidence level99- That `PATTERNS.md` was regenerated100- That `uv run pytest tests/steps -q` passed101102---103104## Boundaries105106### Do107- Reuse the live pattern format from `small-dataset-lora.md`108- Keep triggers concrete109- Keep advice prescriptive and easy to apply110- Regenerate `PATTERNS.md`111- Run tests every time112113### Don’t114- Don’t modify existing patterns115- Don’t modify `step.toml` strategy blocks here116- Don’t invent step ids117- Don’t label a new idea `high` confidence without evidence118- Don’t stop before tests pass119120---121122## When Stuck123124- If the step scope is unclear, look at `src/nemotron/steps/STEPS.md` and ask which ids the contributor actually wants.125- If the trigger is vague, rewrite it as an observable condition before writing the file.126- If the concept is still experimental, mark it `experimental` rather than overstating certainty.127- If the pattern overlaps an existing one, explain the overlap and ask whether this should be a separate pattern.128- After two failed validation loops, stop and report the exact failing command and error.129130---131132## Calibration Examples133134### Example 1 — simple high-confidence pattern135136User:137> Add a pattern saying we should use a consistent random seed across stages.138139Assistant:140> I’ll confirm whether this is global or limited to a few steps, then I’ll create `src/nemotron/steps/patterns/consistent-random-seed.md` with the required frontmatter and the four body sections.141>142> I’ll mark it `high` confidence only if the guidance is already established team practice, regenerate `PATTERNS.md` with `uv run python src/nemotron/steps/index.py`, and run `uv run pytest tests/steps -q` before I finish.143144### Example 2 — experimental step-scoped pattern145146User:147> Add a pattern for code-generation SFT that uses a higher learning rate.148149Assistant:150> I’ll confirm the exact step ids and keep the scope narrow, for example `sft/automodel` and `sft/megatron_bridge` if that is what you intend.151>152> Because this is a newer idea rather than settled guidance, I’ll label it `experimental`, encode the trigger conditions in frontmatter, create the new pattern markdown file, regenerate `PATTERNS.md`, and run `uv run pytest tests/steps -q`.