Agent Consumption Model
Lore Protocol is designed for AI agent workflows. This page describes the recommended consumption patterns.
Pre-Built Agent Skill Files
Section titled “Pre-Built Agent Skill Files”The Lore CLI ships with ready-to-use instruction files for popular AI coding agents. Copy one file into your project and the agent will automatically query Lore before modifying code and write Lore-enriched commits.
| Agent | File | Destination |
|---|---|---|
| Claude Code | skills/adapters/claude-code.md | Append to CLAUDE.md |
| Cursor | skills/adapters/cursor.mdc | .cursor/rules/lore.mdc |
| GitHub Copilot | skills/adapters/github-copilot.md | .github/copilot-instructions.md |
| Windsurf | skills/adapters/windsurf.md | .windsurfrules |
| Aider | skills/adapters/aider.md | .aider/lore-instructions.md |
| Any other agent | skills/adapters/generic.md | Paste into system prompt |
The comprehensive reference is skills/lore-agent-instructions.md. The platform adapters are streamlined versions formatted for each platform’s conventions.
Discovery
Section titled “Discovery”An agent enters a project and detects Lore support:
# Check for .lore/ directoryls .lore/config.toml
# Or check if the CLI is availablelore --helpBefore Modifying a File
Section titled “Before Modifying a File”Load full decision context in JSON for reliable parsing:
# Full context for the filelore context src/auth/interceptor.ts --json --limit 30
# Or specific querieslore constraints src/auth/interceptor.ts --jsonlore directives src/auth/interceptor.ts --jsonlore rejected src/auth/interceptor.ts --jsonBefore Modifying a Specific Function
Section titled “Before Modifying a Specific Function”Use line-level context:
lore why src/auth/interceptor.ts:45 --jsonChecking for Stale Knowledge
Section titled “Checking for Stale Knowledge”Before trusting existing context, check for staleness:
lore stale src/auth/ --jsonWriting a Lore-Enriched Commit
Section titled “Writing a Lore-Enriched Commit”The agent constructs JSON and pipes to lore commit:
echo '{ "intent": "Add rate limiting to token refresh endpoint", "body": "Upstream auth service now enforces 10 req/s per client.", "trailers": { "Constraint": ["Auth service rate-limits to 10 req/s per client ID"], "Rejected": [ "Client-side token cache | stale token risk in distributed deployments" ], "Confidence": "high", "Scope-risk": "narrow", "Reversibility": "clean", "Supersedes": ["a7f3b2c1"], "Tested": ["Rate limit exceeded returns 429 with retry-after header (unit)"], "Not-tested": ["Behavior under concurrent refresh from multiple instances"] }}' | lore commit --jsonKey behaviors:
Lore-idis auto-generated — never provided by the caller- Only commits already staged changes — the agent must
git addfirst - If nothing is staged, exits with code 3
- Errors are returned as structured JSON on stderr when
--jsonis active - Array trailers accept both arrays and single strings —
"Constraint": "single value"is coerced to["single value"]
JSON Input Schema
Section titled “JSON Input Schema”{ "type": "object", "required": ["intent"], "properties": { "intent": { "type": "string", "maxLength": 72 }, "body": { "type": "string" }, "trailers": { "type": "object", "properties": { "Constraint": { "type": ["array", "string"], "items": { "type": "string" } }, "Rejected": { "type": ["array", "string"], "items": { "type": "string" } }, "Confidence": { "enum": ["low", "medium", "high"] }, "Scope-risk": { "enum": ["narrow", "moderate", "wide"] }, "Reversibility": { "enum": ["clean", "migration-needed", "irreversible"] }, "Directive": { "type": ["array", "string"], "items": { "type": "string" } }, "Tested": { "type": ["array", "string"], "items": { "type": "string" } }, "Not-tested": { "type": ["array", "string"], "items": { "type": "string" } }, "Supersedes": { "type": ["array", "string"], "items": { "type": "string" } }, "Depends-on": { "type": ["array", "string"], "items": { "type": "string" } }, "Related": { "type": ["array", "string"], "items": { "type": "string" } } } } }}Array trailers accept either ["value1", "value2"] or "single value" (coerced to a single-element array).
Preparing a Squash Merge
Section titled “Preparing a Squash Merge”lore squash outputs a raw commit message (not JSON), suitable for git commit -F:
lore squash main..HEAD > /tmp/squash-msg.txt# Review/edit, then:git checkout maingit merge --squash feature-branchgit commit -F /tmp/squash-msg.txt