Skip to content

rai pattern

Manage learned patterns. Patterns capture learnings from development — process improvements, technical discoveries, and architectural decisions.

Add a new pattern to memory.

ArgumentDescription
CONTENTPattern description (required)
FlagShortDescription
--context-cContext keywords (comma-separated)
--type-tPattern type: codebase, process, architecture, technical. Default: process
--from-fStory/session where learned
--scope-sMemory scope: global, project, personal. Default: personal
--memory-dir-mMemory directory path (overrides scope)
Terminal window
# 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

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.

ArgumentDescription
PATTERN_IDPattern ID to reinforce, e.g. PAT-E-183 (required)
FlagShortDescription
--vote-vVote: 1 (applied), 0 (N/A), -1 (contradicted) (required)
--from-fStory ID for traceability
--scope-sMemory scope: global, project, personal. Default: project
--memory-dir-mMemory directory path (overrides scope)
Terminal window
# Pattern was applied
rai pattern reinforce PAT-E-183 --vote 1 --from RAISE-170
# Pattern not relevant
rai pattern reinforce PAT-E-151 --vote 0 --from RAISE-170
# Pattern contradicted
rai pattern reinforce PAT-E-094 --vote -1 --from RAISE-170

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.

ArgumentDescription
PATTERN_IDPattern ID to promote, e.g. PAT-E-123 (required)
FlagShortDescription
--memory-dir-mMemory directory path (overrides default)
Terminal window
rai pattern promote PAT-E-123

See also: rai graph query, rai signal emit-work