Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add koersliven/Lore --skill lore-constraintgit clone --depth 1 https://github.com/koersliven/LoreWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/koersliven/lore/lore-constraint)<a href="https://agentmods.dev/skills/koersliven/lore/lore-constraint"><img src="https://agentmods.dev/badge/skills/koersliven/lore/lore-constraint/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/koersliven/lore/lore-constraint"><img src="https://agentmods.dev/badge/skills/koersliven/lore/lore-constraint.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00018 | $0.01506 |
| Opus 5.5 | $0.00007 | $0.00602 |
| Sonnet 5.5 | $0.00004 | $0.00301 |
| Haiku 4.5 | $0.00002 | $0.00151 |
Grade A, and why
lore-constraint scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 201 lines — stays where its author put it; the contents beside it link to each section on GitHub.
L2 约束层 — 知识沉淀与保护
L2 是介于 L1(结构层)和 L3(过程层)之间的"稳定层"。它存储那些经过验证、长期有效、一旦错了影响大的知识。
核心概念
L3 过程知识(高频变化)
↓ 多次验证 + 长期稳定
L2 约束知识(低频变化,高影响)
↓ 组织级约定 / 架构边界
L1 结构知识(代码可表达)
L2 的特点:
- 变化慢(季度/年级别)
- 一旦错了影响大(线上事故、架构违规)
- 需要更高阈值才能修改
约束层内容
典型 L2 知识
## L2 Constraints
### Architecture Boundaries
- 订单模块不能直接调用库存模块,必须通过 MQ
- 支付回调必须幂等,防止重复扣款
### Data Constraints
- order 表不能加唯一索引(并发写入场景)
- 用户 ID 必须通过 UserService 获取,禁止本地缓存
### Business Rules
- 图片最少 3 张(ICBU 发品要求)
- 类目预测失败时走 QP 兜底
### External Contracts
- HSF 接口 OpenApiCategoryPredictService 是对外接口,不可随意修改签名
Process
Step 1: Knowledge Promotion Detection
/evolve 编译时,自动检测哪些 L3 知识可以提升为 L2:
提升条件(全部满足):
- 知识存在时间 >= 30 天
- 被至少 3 个 increment 引用或验证
- 从未被 challenge 或推翻
- 类型为 CONSTRAINT 或关键 DECISION
自动标记:
### [PROMOTION CANDIDATE] 支付回调必须幂等
- 存在时间: 45 天
- 验证次数: 5 次
- 状态: pending_promotion
Step 2: Human Confirmation for Promotion
L2 提升需要人工确认(不能全自动):
[AI-CONTEXT] 检测到 2 条知识可提升为 L2 约束:
1. "支付回调必须幂等" (45 天, 5 次验证)
2. "订单表不能加唯一索引" (60 天, 3 次验证)
是否确认提升?确认后修改需要更高阈值。
用户确认后,写入 .ai-context/constraints.md。
Step 3: Constraint Protection
L2 知识变更需要更高阈值:
| 变更类型 | L3 阈值 | L2 阈值 |
|---|---|---|
| 新增 | 对话中说出即可 | 需要 L3 验证 + 人工确认 |
| 修改 | 新 increment 覆盖 | 需要 PR review + 2 人确认 |
| 删除 | 新 increment 推翻 | 需要 PR review + 架构师确认 |
实现方式:
pre-edit-guard.sh检测到 L2 知识关联时,输出更强的警告/evolve编译时,L2 变更需要额外的确认步骤
Step 4: Constraint Index
L2 约束独立存储,不与 snapshot 混在一起:
.ai-context/
├── snapshot.md ← L1 + L3 混合(agent 入场读取)
├── constraints.md ← L2 独立(优先加载,高保护)
├── buffer.md
└── increments/
constraints.md 格式:
# L2 Constraints
> Last updated: 2026-04-24
> Total: 8 constraints
## Architecture Boundaries
### 订单-库存解耦
- 规则: 订单模块不能直接调用库存模块,必须通过 MQ
- 原因: 防止库存服务故障导致订单不可用
- 来源: 利普, 2026-03-15, 架构评审
- 验证: 5 次, 从未推翻
- 保护级别: high (修改需架构师确认)
## Data Constraints
### order 表无唯一索引
- 规则: order 表不能加唯一索引
- 原因: 并发写入场景,唯一索引会导致死锁
- 来源: 张三, 2026-02-20, 线上事故复盘
- 验证: 3 次, 从未推翻
- 保护级别: critical (修改需 CTO 确认)
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 201 lines · 18 tokens per session scan A e25119c23c6b
lore-constraint is a skill published in the GitHub repository koersliven/Lore (5 stars, last pushed 6mo ago), licensed Apache-2.0. It adds 18 tokens to every session and 1,506 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
context-end
Close a workspace session by reviewing a proposed summary, recording approved outcomes, updating state and decisions, and checking repository safety. Use only when the user explicitly asks to end, close, or hand off the current session.
context-update
Save a brief mid-session checkpoint to this workspace and update current state only when a priority or open thread changed. Use only when the user explicitly asks to checkpoint or save current progress.
faf-expert
Expert in .faf (Foundational AI-context Format) files for persistent project context. Use when working with .faf files, project DNA, CLAUDE.md bi-sync, faf-cli commands, MCP server configuration, or AI-readiness scoring (0-100%). Updated for v2.8.0 Tool Visibility System.
contextos-workspace
Run Context OS continuity and lifecycle workflows in a user-selected Context OS workspace. Use when asked to inspect, set up, update, or close a Context OS session.
personal-context
Interview the user to build or update a reusable "about me" context file for AI tools — who they are, their role and background, how they work, and how they want AI to help. Use when the user says "build my personal context", "create my about-me context", "set up my AI context", "update my personal context", or wants…
refresh-context
Review and refresh an existing personal-context.md or company-context.md — check what has gone stale, fill gaps against the current template, and update the file. Use when the user says "refresh my context", "review my context", "is my context still up to date", "my context is stale", or after a change in role, offer…