Agent Consumption Model
Lore Protocol is designed for AI agent workflows. This page describes the recommended consumption patterns.
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
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", "items": { "type": "string" } }, "Rejected": { "type": "array", "items": { "type": "string" } }, "Confidence": { "enum": ["low", "medium", "high"] }, "Scope-risk": { "enum": ["narrow", "moderate", "wide"] }, "Reversibility": { "enum": ["clean", "migration-needed", "irreversible"] }, "Directive": { "type": "array", "items": { "type": "string" } }, "Tested": { "type": "array", "items": { "type": "string" } }, "Not-tested": { "type": "array", "items": { "type": "string" } }, "Supersedes": { "type": "array", "items": { "type": "string" } }, "Depends-on": { "type": "array", "items": { "type": "string" } }, "Related": { "type": "array", "items": { "type": "string" } } } } }}Preparing a Squash Merge
Section titled “Preparing a Squash Merge”lore squash main..HEAD --json > /tmp/squash.json# Agent reviews and adjusts, then:lore commit --file /tmp/squash.json