rai pattern
Manage learned patterns. Patterns capture learnings from development — process improvements, technical discoveries, and architectural decisions.
rai pattern add¶
Add a new pattern to memory.
| Argument | Description |
|---|---|
CONTENT |
Pattern description (required) |
| Flag | Short | Description |
|---|---|---|
--context |
-c |
Context keywords (comma-separated) |
--type |
-t |
Pattern type: codebase, process, architecture, technical. Default: process |
--from |
-f |
Story/session where learned |
--scope |
-s |
Memory scope: global, project, personal. Default: project |
--memory-dir |
-m |
Memory directory path (overrides scope) |
:::caution[Breaking Change — Default Scope (v2.3.0)]
The default value of --scope changed from personal to project.
Before (v2.2.x): rai pattern add "..." saved to personal patterns.
After (v2.3.0): rai pattern add "..." saves to project patterns.
To use the old behavior, pass the scope explicitly: rai pattern add "..." --scope personal.
:::
# Add a process pattern
rai pattern add "HITL before commits" -c "git,workflow"
# Add a technical pattern with source
rai pattern add "Use capsys for stdout tests" -t technical -c "pytest,testing"
# Add with source reference
rai pattern add "BFS reuse across modules" -t architecture --from S2.3
rai pattern reinforce¶
Record a reinforcement signal for a pattern. Called at story-review to indicate whether a pattern was applied (1), not relevant (0), or contradicted (-1). Vote 0 (N/A) does not count toward the evaluation total.
| Argument | Description |
|---|---|
PATTERN_ID |
Pattern ID to reinforce, e.g. PAT-001 (required) |
| Flag | Short | Description |
|---|---|---|
--vote |
-v |
Vote: 1 (applied), 0 (N/A), -1 (contradicted) (required) |
--from |
-f |
Story ID for traceability |
--scope |
-s |
Memory scope: global, project, personal. Default: project |
--memory-dir |
-m |
Memory directory path (overrides scope) |
# Pattern was applied
rai pattern reinforce PAT-001 --vote 1 --from S101
# Pattern not relevant
rai pattern reinforce PAT-002 --vote 0 --from S101
# Pattern contradicted
rai pattern reinforce PAT-003 --vote -1 --from S101
rai pattern promote¶
Promote a pattern from personal scope to project scope. Moves the pattern entry from personal patterns.jsonl to project patterns.jsonl. The pattern ID is preserved.
| Argument | Description |
|---|---|
PATTERN_ID |
Pattern ID to promote, e.g. PAT-001 (required) |
| Flag | Short | Description |
|---|---|---|
--memory-dir |
-m |
Memory directory path (overrides default) |
See also: [rai graph query](graph.md/, [rai signal emit-work](signal.md/