lore-constraint

lore-constraint is a skill for Claude Code, Codex from koersliven/Lore. It costs 18 tokens per session (1,506 once invoked), scanned A, original, Apache-2.0.

A knowledge-management layer for storing stable project rules, decisions, and external agreements. It sits between code structure and frequently changing process notes, and is intended for rules that are important to keep correct.

In plain words
What is it for?
It is for identifying rules that may deserve long-term storage, requesting confirmation before promoting them, and protecting approved constraints from casual changes.
Why use it?
It separates long-lasting constraints from temporary notes, making critical architecture, data, business, and interface rules easier to protect.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It is for identifying rules that may deserve long-term storage, requesting confirmation before promoting them, and protecting approved constraints from casual changes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/koersliven/lore/lore-constraint
Install

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.

Any agent
npx skills add koersliven/Lore --skill lore-constraint
Clone the repo
git clone --depth 1 https://github.com/koersliven/Lore

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for lore-constraint

README.md
[![agentmods](https://agentmods.dev/badge/skills/koersliven/lore/lore-constraint.svg)](https://agentmods.dev/skills/koersliven/lore/lore-constraint)
Your own site
<a href="https://agentmods.dev/skills/koersliven/lore/lore-constraint"><img src="https://agentmods.dev/badge/skills/koersliven/lore/lore-constraint.svg" alt="Measured on agentmods" height="20"></a>
Per session 18 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,506 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00018 $0.01506
Opus 5 $0.00009 $0.00753
Sonnet 5 $0.00004 $0.00301
Haiku 4.5 $0.00002 $0.00151

Measured 7d ago against content hash e25119c23c6b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

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 7d 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.

skills/lore-constraint/SKILL.md · 201 lines

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:

提升条件(全部满足)

  1. 知识存在时间 >= 30 天
  2. 被至少 3 个 increment 引用或验证
  3. 从未被 challenge 或推翻
  4. 类型为 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 确认)

Read the full file on GitHub · 201 lines

Changes

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.

  1. 7d ago First seen · 201 lines · 18 tokens per session scan A e25119c23c6b

Subscribe to this mod's changes

lore-constraint is a skill published in the GitHub repository koersliven/Lore (5 stars, last pushed 4mo 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. 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.

Related

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.

conorbronsdon/agent-context-os · 46 tokens

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.

Wolfe-Jam/grok-faf-mcp · 69 tokens

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.

conorbronsdon/agent-context-os · 39 tokens

import

Import a self-contained NeatContext context bundle shared by another person, or reconcile a newer copy of a context already on this machine, leaving the source bundle unchanged. Use only when the user explicitly invokes this skill or asks to import a NeatContext bundle.

XTSoftwareLabs/neatcontext-plugins · 54 tokens

save

Save durable decisions, findings, plans, and implementation knowledge from the visible Codex conversation into a new or existing NeatContext context. Use only when the user explicitly invokes this skill or asks to preserve the current conversation as reusable context.

XTSoftwareLabs/neatcontext-plugins · 49 tokens

create

Create a fresh NeatContext context from a user-defined behavioral profile and an existing local knowledge folder. Use only when the user explicitly invokes this skill or asks to create a new context rather than save the current conversation.

XTSoftwareLabs/neatcontext-plugins · 45 tokens