🌍: 简体中文(普通话) / English
⚠️ Work in progress — the spec format and CLI are under active evolution. Expect breaking changes.🐕 Bootstrapped — intent before execution: we wrote the design doc first, then agents bootstrapped the entire project from it, following the full 立意 pattern before the first line of code. Specs track code: when source or requirements change,
liyi checkdetects staleness and the agent resolves it automatically — code and intent stay in sync.
立意 is a convention and CLI tool that makes intent explicit, persistent, and reviewable in AI-assisted software development. It pairs every code item with a human-readable statement of what the item should do, stored in language-agnostic sidecar files (.liyi.jsonc). A CI linter (liyi check) detects when source changes outpace intent — catching staleness, orphaned specs, and broken requirement edges — so that the gap between "what the AI wrote" and "what the human intended" never grows silently.
# Install (from source)
cargo install --path crates/liyi-cli
# Have an agent generate intent specs (writes .liyi.jsonc files)
# You can just tell it to — no special command, the agent is the command
# Then fill in hashes:
liyi check --fix --root .
# Run manually, or wire into CI:
liyi check --root .- Agent infers intent — today's agents automatically read
AGENTS.md, which teaches them the 立意 pattern. During normal development they maintain.liyi.jsoncsidecar files for each code item, withsource_spanand natural-languageintent. If they don't do it automatically, you can always tell them to. liyi check— hashes source spans, detects staleness and shifts, checks review status, tracks requirement edges. Zero network, zero LLM, fully deterministic.liyi reanchor— re-hashes spans after intentional code changes. Never modifies intent or review state.- Human reviews — sets
"reviewed": truein the sidecar to approve, or adds@liyi:intentin source to provide the authoritative human version.
| Level | What you do | What you get |
|---|---|---|
| 0 | Copy AGENTS.md paragraph into your repo |
Agent writes .liyi.jsonc instead of nothing |
| 1 | Add liyi check to CI |
Staleness detection on every push |
| 2 | Review intent, set reviewed: true |
Guaranteed human-in-the-loop on meaning |
| 3 | Add @liyi:requirement markers |
Cross-cutting concerns tracked transitively |
| 4 | Use @liyi:intent in source |
Intent lives next to code, survives refactors |
| 5 | Generate adversarial tests from reviewed intent | Tests that catch subtle semantic drift |
liyi check [OPTIONS] [PATHS]...
--fix Auto-correct shifted spans, fill missing hashes
--fail-on-stale <true|false> Fail on stale specs (default: true)
--fail-on-unreviewed <true|false> Fail on unreviewed specs (default: false)
--fail-on-req-changed <true|false> Fail on changed requirements (default: true)
--root <PATH> Override repo root
liyi reanchor [FILE]
--item <NAME> Target a specific item
--span <S,E> Override span (1-indexed, inclusive)
--migrate Schema version migration
| Code | Meaning |
|---|---|
| 0 | All specs current, no failures |
| 1 | Check failure (stale, unreviewed, req-changed) |
| 2 | Internal error (malformed JSONC, unknown schema version) |
SPDX-License-Identifier: Apache-2.0 OR MIT