Salacia Init
Generate a scope contract for the current task.
What to do
Ask the user what task they're working on (or read from git branch name / recent context)
Analyze the task description to extract:
- Keywords → map to file paths (use project structure)
- Quoted file paths in the description
- Conventional commit prefix (feat/fix/docs/chore) → scope width
Check
.salacia/memory.jsonfor historical patterns. If it exists, read the pattern matching the detected task type (feat/fix/etc.). Pre-fillsoftAllowedPathswith entries whereweight >= 0.5. This lets the contract benefit from past session learning.Generate
.salacia/contract.json:
{
"taskId": "<from branch or user input>",
"allowedPaths": ["<extracted paths>"],
"softAllowedPaths": ["<sibling dirs, co-change companions>"],
"excludedPaths": ["node_modules/**", ".git/**", "dist/**"],
"protectedPaths": [".env", ".env.*", "*.pem", "*.key", "*.cert", "package-lock.json", "bun.lockb"],
"maxFilesChanged": 10,
"generatedAt": "<timestamp>",
"generatedBy": "heuristic"
}
- Also create
.salacia/config.jsonif it doesn't exist:
{
"enabled": true,
"driftThreshold": 30
}
- Reset
.salacia/drift.jsonto zero state:
{
"score": 0,
"files": [],
"softFiles": [],
"outOfScope": [],
"protected": []
}
- Report the contract summary to the user (include any memory-derived soft paths)
Scope width heuristics
- fix: narrow — only files mentioned + their test files
- feat: medium — mentioned files + sibling directory + tests
- refactor: wide — entire package the files belong to
- docs: docs/** + README.md only
- chore: wide — config files + root files allowed
Notes
- Contract is stored in
.salacia/(gitignored) - The guard hook (PreToolUse/PostToolUse) reads this contract automatically
- Zero token cost for enforcement — hooks run as shell commands
- To disable: set
enabled: falsein.salacia/config.json