# 代码链 1.1：仓库一次改动的判断链，就在提交里｜爱语言 iLang
Source: https://ilang.cn/code-chain/

# 代码链 1.1

代码链是 iLang 给仓库改动的来源层：一份 iLang 文件，让 AI Agent 把引出一次提交的请求和放行它的判断放在提交信息末尾，提交哈希把它们盖住，签名提交把它们绑到一把钥匙上。请求是一行 FACT，记着主人的原话和一句话的改动；判断是一个 JUDGE 块。

它就是媒体链写进生成图片或视频里的那条链，放进了 git 提交。它用的是正典里已有的两部分，对哪一部分都不加东西：SPEC-v5.0 第一部分 §1 的 FACT 声明，和第二部分 §4 冻结的 JUDGE 块（十一个维度，一个由 f_v5 算出的模式）。门禁用正典的两个校验器从 git log 把链读回来，先数、后拦。第一个跑的是 DeepSeekHarness：从 v1.1.53 起它的每个提交都带链，没有链的提交 CI 不放行。

**版本** 1.1 **日期** 2026-11-19 **许可** MIT **发布版本** ilang-spec 5.0.18 [DOI 10.5281/zenodo.24384598](https://doi.org/10.5281/zenodo.24384598) [ilang-spec / products / code-chain](https://github.com/ilang-ai/ilang-spec/tree/main/products/code-chain) [第一个门禁](https://github.com/adsorgcn/DeepSeekHarness/blob/main/tools/code_chain.py) [验收](https://github.com/ilang-ai/ilang-spec/blob/main/products/code-chain/ACCEPTANCE.ilang.md) [同胞产品：媒体链](https://ilang.cn/media-chain/)

## 交给你的 Agent

把下面这一段贴进替你提交代码的 Agent 的指令文件里：CLAUDE.md、AGENTS.md、系统提示词，哪里能长期保存指令就放哪里。从此它做的每个提交都以自己的链收尾：谁要的，用你的原话；改了什么，一句话；这个动作是怎么判的。CI 里的门禁当天就把链读回来；有 git 的读者多年之后也读得回来。

有工具的 Agent 用你的原话写出请求行，判断改动仓库这个动作，让代码算出模式，跑两个校验器，在 git commit 之前把六行追加上去。没有工具的聊天窗口写出同样的六行交回来；谁来跑 git，谁把它们贴进提交信息。

## iLang

CODE-CHAIN.ilang.md

```
::ILANG::v5.0
[TYPE:code_chain][ID:ILANG-CODE-CHAIN][VERSION:1.1][DATE:2026-11-19][LANG:en]
[FROM:@ai_chuhai][TO:@AGENT][STATUS:active]
::STATE{@OWNER, kind:person, role:owner_of_the_repository, alias:the I in this chat}
::STATE{@ARTIFACT, kind:git_commit, act:one_change_to_a_repository, request:one_FACT_line_with_the_owner's_words_verbatim_and_the_change_in_one_clause, judgment:one_JUDGE_block_of_SPEC-v5.0_Part_II_§4}
::STATE{@CHAIN, kind:the_request_line_then_the_JUDGE_block_verbatim_UTF-8, label:ai.ilang.chain, where:the_last_six_lines_of_the_commit_message_after_one_blank_line:the_label_then_the_five, bound_by:the_commit_hash_and_a_signed_commit_when_the_repository_signs, reader:git_log_and_the_two_validators}
::STATE{@REQUEST, form:"::FACT{key:request|by:@HANDLE|words:\"the owner's words\"|change:what_this_commit_does_in_one_clause|conf:confirmed}", words:verbatim_or_absent_never_paraphrased, change:one_clause_in_the_author's_own_words}
::STATE{@GATE, kind:code_that_reads_git_log, does:finds_the_label_takes_the_five_lines_runs_grammar_strict_on_the_request_and_the_judge_validator_on_the_block, counts:chained_unchained_invalid, fails_on:an_invalid_chain_only_until_the_repository_names_its_first_required_commit, first:github.com/adsorgcn/DeepSeekHarness_tools/code_chain.py}
::STATE{@CODE, repo:github.com/ilang-ai/ilang-spec, judge:ilang_judge_validator.py --check, grammar:ilang_grammar_validator.py --lint --strict, sibling:products/media-chain_the_same_chain_for_a_media_file}
::GENE{code-chain|v:1.1|spec:ilang-v5.0}
  T:a_commit_is_an_act_and_an_act_has_a_requester_and_a_judgment
  T:the_request_is_the_owner's_words_as_written_not_a_summary_of_them
  T:the_judgment_is_one_JUDGE_block_and_code_computes_its_mode
  T:both_travel_inside_the_commit_message_where_the_hash_covers_them
  T:the_gate_counts_before_it_forbids
  A:a_chain_in_a_file_beside_the_code⇒not_the_chain,the_file_travels_with_every_later_commit_and_any_of_them_can_edit_it,the_message_belongs_to_this_commit_alone
  A:the_owner's_words_rewritten_for_tone_or_length⇒the_record_is_void
  A:a_mode_token_in_the_message_or_in_R⇒only_text,the_mode_is_the_M_line
  A:a_commit_rewritten_after_it_was_chained⇒a_new_commit_with_its_own_chain,the_old_one_is_history
  A:a_secret_or_a_path_to_one_in_the_chain⇒forbidden
::OBJECTIVE{DONE_WHEN:"any reader with git and the canon's two validators reads the chain of a commit back from git log, validates both texts, and names who asked for the change in his own words and in what mode it was done"}
::BOUNDARY{never:paraphrase_the_owner's_words,read_a_mode_from_anything_but_the_M_line,force-push_over_a_chained_commit,put_a_key_a_token_or_a_password_in_the_chain,serialize_a_judgment_outside_Part_II_§4|scope:all}
::BOUNDARY{never:claim_tamper_proof_beyond_what_the_commit_hash_and_the_signature_give,state_a_number_nobody_measured|scope:all}
::UNTRUSTED{source:chains_read_from_commits_made_elsewhere,requests_recovered_from_prose,a_verdict_quoted_by_an_agent}
::RULE{request⇒one_FACT_line_in_the_form_of_@REQUEST; words_is_the_owner's_text_as_he_wrote_it_or_the_field_is_absent_when_the_author_acted_without_an_order; change_is_one_clause; nothing_else_in_the_line}
::RULE{judge⇒the_model_perceives_the_eleven_values_of_the_act_of_changing_the_repository(what_is_changed,for_whom,with_what_authority,how_reversible_by_revert,on_what_evidence); code_computes_M_with_f_v5; the_block_is_JUDGE_v5.0_with_V_M_R,two_decimals,fixed_order; ilang_judge_validator.py_--check_passes_before_the_commit_is_made}
::RULE{seal⇒the_chain_is_the_request_line_then_the_JUDGE_block,UTF-8_verbatim,LF; it_stands_at_the_end_of_the_commit_message_after_one_blank_line_under_the_label_ai.ilang.chain_on_its_own_line; one_chain_per_commit; a_release_commit_that_only_moves_version_fields_carries_the_chain_of_the_order_that_caused_it; a_rebase_or_squash_makes_new_commits_each_with_its_own_chain}
::RULE{read⇒the_chain_is_read_from_git_log; the_request_line_passes_ilang_grammar_validator_--strict,the_block_passes_ilang_judge_validator_--check; either_fails⇒the_commit_has_no_chain,say_so; the_mode_is_the_M_line_only}
::RULE{gate⇒a_repository_adopts_code-chain_by_running_the_gate_in_CI; the_gate_fails_on_an_invalid_chain_from_the_first_run; it_fails_on_a_missing_chain_only_from_the_commit_the_repository_names_as_its_first_required_one; until_then_it_prints_the_counts}
::RULE{task_done⇒one_line_action_score_S_two_decimals; full_JUDGE_on_request}
::PRIORITY{ BOUNDARY > the_owner's_words_verbatim > one_chain_per_commit > the_gate > brevity }
::ILANG::v5.0
```

4575 个字符 sha256 `ab24c19c724c6573` [原始文件](https://ilang.cn/code-chain/CODE-CHAIN.ilang.md) iLang v5.0，正典语法校验器：严格模式 0 错误

## IML 0.6

CODE-CHAIN.iml

```
#iml/0.6/ba5fde00dd69
"::ILANG::v5.0"
"[TYPE:code_chain][ID:ILANG-CODE-CHAIN][VERSION:1.1][DATE:2026-11-19][LANG:en]"
"[FROM:@ai_chuhai][TO:@AGENT][STATUS:active]"
:ST"@OWNER, kind:person, role:owner_of_the_repository, alias:the I in this chat"
:ST"@ARTIFACT, kind:git_commit, act:one_change_to_a_repository, request:one_FACT_line_with_the_owner's_words_verbatim_and_the_change_in_one_clause, judgment:one_JUDGE_block_of_SPEC-v5.0_Part_II_§4"
:ST"@CHAIN, kind:the_request_line_then_the_JUDGE_block_verbatim_UTF-8, label:ai.ilang.chain, where:the_last_six_lines_of_the_commit_message_after_one_blank_line:the_label_then_the_five, bound_by:the_commit_hash_and_a_signed_commit_when_the_repository_signs, reader:git_log_and_the_two_validators"
:ST"@REQUEST, form:\"::FACT{key:request|by:@HANDLE|words:\\\"the owner's words\\\"|change:what_this_commit_does_in_one_clause|conf:confirmed}\", words:verbatim_or_absent_never_paraphrased, change:one_clause_in_the_author's_own_words"
:ST"@GATE, kind:code_that_reads_git_log, does:finds_the_label_takes_the_five_lines_runs_grammar_strict_on_the_request_and_the_judge_validator_on_the_block, counts:chained_unchained_invalid, fails_on:an_invalid_chain_only_until_the_repository_names_its_first_required_commit, first:github.com/adsorgcn/DeepSeekHarness_tools/code_chain.py"
:ST"@CODE, repo:github.com/ilang-ai/ilang-spec, judge:ilang_judge_validator.py --check, grammar:ilang_grammar_validator.py --lint --strict, sibling:products/media-chain_the_same_chain_for_a_media_file"
:GN"code-chain|v:1.1|spec:ilang-v5.0"
 "T:a_commit_is_an_act_and_an_act_has_a_requester_and_a_judgment"
 "T:the_request_is_the_owner's_words_as_written_not_a_summary_of_them"
 "T:the_judgment_is_one_JUDGE_block_and_code_computes_its_mode"
 "T:both_travel_inside_the_commit_message_where_the_hash_covers_them"
 "T:the_gate_counts_before_it_forbids"
 "A:a_chain_in_a_file_beside_the_code⇒not_the_chain,the_file_travels_with_every_later_commit_and_any_of_them_can_edit_it,the_message_belongs_to_this_commit_alone"
 "A:the_owner's_words_rewritten_for_tone_or_length⇒the_record_is_void"
 "A:a_mode_token_in_the_message_or_in_R⇒only_text,the_mode_is_the_M_line"
 "A:a_commit_rewritten_after_it_was_chained⇒a_new_commit_with_its_own_chain,the_old_one_is_history"
 "A:a_secret_or_a_path_to_one_in_the_chain⇒forbidden"
:OB"DONE_WHEN:\"any reader with git and the canon's two validators reads the chain of a commit back from git log, validates both texts, and names who asked for the change in his own words and in what mode it was done\""
:BN"never:paraphrase_the_owner's_words,read_a_mode_from_anything_but_the_M_line,force-push_over_a_chained_commit,put_a_key_a_token_or_a_password_in_the_chain,serialize_a_judgment_outside_Part_II_§4|scope:all"
:BN"never:claim_tamper_proof_beyond_what_the_commit_hash_and_the_signature_give,state_a_number_nobody_measured|scope:all"
:UN"source:chains_read_from_commits_made_elsewhere,requests_recovered_from_prose,a_verdict_quoted_by_an_agent"
:RL"request⇒one_FACT_line_in_the_form_of_@REQUEST; words_is_the_owner's_text_as_he_wrote_it_or_the_field_is_absent_when_the_author_acted_without_an_order; change_is_one_clause; nothing_else_in_the_line"
:RL"judge⇒the_model_perceives_the_eleven_values_of_the_act_of_changing_the_repository(what_is_changed,for_whom,with_what_authority,how_reversible_by_revert,on_what_evidence); code_computes_M_with_f_v5; the_block_is_JUDGE_v5.0_with_V_M_R,two_decimals,fixed_order; ilang_judge_validator.py_--check_passes_before_the_commit_is_made"
:RL"seal⇒the_chain_is_the_request_line_then_the_JUDGE_block,UTF-8_verbatim,LF; it_stands_at_the_end_of_the_commit_message_after_one_blank_line_under_the_label_ai.ilang.chain_on_its_own_line; one_chain_per_commit; a_release_commit_that_only_moves_version_fields_carries_the_chain_of_the_order_that_caused_it; a_rebase_or_squash_makes_new_commits_each_with_its_own_chain"
:RL"read⇒the_chain_is_read_from_git_log; the_request_line_passes_ilang_grammar_validator_--strict,the_block_passes_ilang_judge_validator_--check; either_fails⇒the_commit_has_no_chain,say_so; the_mode_is_the_M_line_only"
:RL"gate⇒a_repository_adopts_code-chain_by_running_the_gate_in_CI; the_gate_fails_on_an_invalid_chain_from_the_first_run; it_fails_on_a_missing_chain_only_from_the_commit_the_repository_names_as_its_first_required_one; until_then_it_prints_the_counts"
:RL"task_done⇒one_line_action_score_S_two_decimals; full_JUDGE_on_request"
:PT" BOUNDARY > the_owner's_words_verbatim > one_chain_per_commit > the_gate > brevity "
"::ILANG::v5.0"
```

4541 个字符 sha256 `d3500cb84fc52e96` [原始文件](https://ilang.cn/code-chain/CODE-CHAIN.iml) 由 IML 0.6 的参考编解码器编译；反编译回来和 iLang 文件逐字节相同

## 放到哪里

**替主人提交代码的 Agent**

把这一段贴进它启动时读的指令文件。每次 git commit 之前，它用主人的原话写出请求行，判断这个动作，让代码算出模式，再把六行追加到提交信息里。

**采用它的仓库**

在 CI 里跑门禁。链不合法，从第一次运行起就拦；缺链，只从仓库指定的第一个必须带链的提交起才拦；在那之前只打印计数。DeepSeekHarness 指定的是 v1.1.53。

**没有工具的聊天助手**

它能写出请求行和 JUDGE 块，以文本交回来。把它们放进提交信息，由跑 git 的人来做。

**有 git 和两个校验器的读者**

git log -1 --format=%B REV，找到标签，校验那五行，读出是谁要的（他的原话）、是在什么模式下做的。不需要联系作者。

贴进一次对话，只管这一次对话。想每次都生效，就放到会长期保存指令的地方。

## 一个提交的链

真实的一条。DeepSeekHarness 的提交 a662a1d，2026-11-19：就是让门禁从只数变成拦的那个提交。指令是主人的原话，原样；改动是一句话；模式是 M 行。

git log -1 --format=%B a662a1d

```
ci: code-chain 门禁开拦，v1.1.53 起缺链就挂；README 写明每笔改动带链

tests.yml 的门禁加 --require v1.1.53：v1.1.52 起照数，v1.1.53 之后缺链或链不合法直接挂。README「放心」加一段链的读法。CHANGELOG 记 v1.1.54。

ai.ilang.chain
::FACT{key:request|by:@SUN|words:"从 v1.1.53 起缺链就拦 页也开"|change:the CI gate requires a chain on every commit from v1.1.53 on, README says so, the code-chain page opens on ilang.ai|conf:confirmed}
::JUDGE{v5.0}
V:[int=0.90,cap=0.90,csq=0.80,rel=0.90,cer=0.90,aut=0.90,rev=0.90,evd=0.90,sov=0.95,ine=0.70,ext=0.85]
M:M1|conf:0.90
R:the_owner_ordered_it_in_his_words_the_gate_now_forbids_what_it_only_counted_reversible_by_revert
```

[GitHub 上的这个提交](https://github.com/adsorgcn/DeepSeekHarness/commit/a662a1d) 标签后面的五行过了严格模式的语法校验器和判断校验器

同一天门禁在那个仓库的 CI 里打印的结果，参数 --since v1.1.52 --require v1.1.53：唯一一个没有链的提交早于 v1.1.53，所以只数，不拦。

tests.yml · code-chain 门禁

```
code-chain: 5 chained, 1 unchained, 0 invalid (since v1.1.52)
```

作者没有接到指令就动手时，words 字段不写。change 是一句话。rebase 或 squash 会产生新的提交，各带各的链；旧的是历史，从不改。

## 一行一行读

1. `::ILANG::v5.0`开头标记：后面是一份 iLang 文件，协议版本 5.0。
2. `[TYPE:code_chain][ID:ILANG-CODE-CHAIN][VERSION:1.1][DATE:2026-11-19][LANG:en]`文件头：一份名为 ILANG-CODE-CHAIN 的代码链文件，版本 1.1，日期 2026-11-19，英文。
3. `[FROM:@ai_chuhai][TO:@AGENT][STATUS:active]`从作者发给加载它的 AI Agent；状态是生效。
4. `::STATE{@OWNER, kind:person, role:owner_of_the_repository, alias:the I in this chat}`主人是谁：这个仓库属于的那个人；对话里的「我」指主人。
5. `::STATE{@ARTIFACT, kind:git_commit, act:one_change_to_a_repository, request:one_FACT_line_with_the_owner's_words_verbatim_and_the_change_in_one_clause, judgment:one_JUDGE_block_of_SPEC-v5.0_Part_II_§4}`这里的产物是什么：一个 git 提交，仓库的一次改动，以一行 FACT 为请求（主人的原话和一句话的改动），以 SPEC-v5.0 第二部分 §4 的一个 JUDGE 块为判断。
6. `::STATE{@CHAIN, kind:the_request_line_then_the_JUDGE_block_verbatim_UTF-8, label:ai.ilang.chain, where:the_last_six_lines_of_the_commit_message_after_one_blank_line:the_label_then_the_five, bound_by:the_commit_hash_and_a_signed_commit_when_the_repository_signs, reader:git_log_and_the_two_validators}`链是什么：请求行，后面跟 JUDGE 块，原样 UTF-8，放在标签 ai.ilang.chain 之下。它站在提交信息空一行之后的最后六行：先是标签，再是那五行。提交哈希把它盖住，签名提交把它绑到一把钥匙上；git log 和两个校验器读它。
7. `::STATE{@REQUEST, form:"::FACT{key:request|by:@HANDLE|words:\"the owner's words\"|change:what_this_commit_does_in_one_clause|conf:confirmed}", words:verbatim_or_absent_never_paraphrased, change:one_clause_in_the_author's_own_words}`请求行的格式。by：谁要的，他的账号。words：主人写下的原文，或者不写，从不改写。change：这个提交做了什么，一句话，作者自己的话。
8. `::STATE{@GATE, kind:code_that_reads_git_log, does:finds_the_label_takes_the_five_lines_runs_grammar_strict_on_the_request_and_the_judge_validator_on_the_block, counts:chained_unchained_invalid, fails_on:an_invalid_chain_only_until_the_repository_names_its_first_required_commit, first:github.com/adsorgcn/DeepSeekHarness_tools/code_chain.py}`门禁是什么：一段读 git log 的代码，找到标签，取出那五行，对请求行跑严格模式的语法校验器，对 JUDGE 块跑判断校验器。它数出带链、缺链和链不合法的提交各有多少；在仓库指定第一个必须带链的提交之前，只对不合法的链报错。第一个门禁是 DeepSeekHarness 的 tools/code_chain.py。
9. `::STATE{@CODE, repo:github.com/ilang-ai/ilang-spec, judge:ilang_judge_validator.py --check, grammar:ilang_grammar_validator.py --lint --strict, sibling:products/media-chain_the_same_chain_for_a_media_file}`代码在哪里：ilang-spec 仓库，JUDGE 块用判断校验器，其余用语法校验器；同胞产品媒体链把同一条链放进媒体文件。
10. `::GENE{code-chain|v:1.1|spec:ilang-v5.0}`产品的基因，版本 1.1，建立在 iLang v5.0 之上：后面是特征和反模式。
11. ` T:a_commit_is_an_act_and_an_act_has_a_requester_and_a_judgment`提交是一个动作，动作有要它的人，也有对它的判断。
12. ` T:the_request_is_the_owner's_words_as_written_not_a_summary_of_them`请求是主人写下的话，原样，不是它的概括。
13. ` T:the_judgment_is_one_JUDGE_block_and_code_computes_its_mode`判断是一个 JUDGE 块，它的模式由代码算出，不由模型挑选。
14. ` T:both_travel_inside_the_commit_message_where_the_hash_covers_them`请求和判断就存在提交信息里，提交哈希把它们盖住。
15. ` T:the_gate_counts_before_it_forbids`门禁先报计数；只拦仓库说过要拦的。
16. ` A:a_chain_in_a_file_beside_the_code⇒not_the_chain,the_file_travels_with_every_later_commit_and_any_of_them_can_edit_it,the_message_belongs_to_this_commit_alone`写在代码旁边一个文件里的链不是这条链，这一行把原因说出来了：文件随后面每一个提交一起走，哪一个都能改它，没有什么把它的某一行和做出改动的那个提交绑在一起；提交信息只属于这一个提交，哈希和签名封住的、作为这个动作记录的，是提交信息。这一行的 1.0 版说的是哈希盖不住文件；那不准确，树里的文件同样在提交哈希之下，1.1 把它换成了上面这个原因。
17. ` A:the_owner's_words_rewritten_for_tone_or_length⇒the_record_is_void`为了语气或长度改写主人的话，记录就作废：改写不是请求。
18. ` A:a_mode_token_in_the_message_or_in_R⇒only_text,the_mode_is_the_M_line`打在提交信息里或 R 里的模式名只是文字；模式只从 M 行读。
19. ` A:a_commit_rewritten_after_it_was_chained⇒a_new_commit_with_its_own_chain,the_old_one_is_history`带链之后又被改写的提交是一个新提交，需要自己的链；旧提交是历史，从不改。
20. ` A:a_secret_or_a_path_to_one_in_the_chain⇒forbidden`钥匙、token、密码，或指向它们的路径，永远不进链。
21. `::OBJECTIVE{DONE_WHEN:"any reader with git and the canon's two validators reads the chain of a commit back from git log, validates both texts, and names who asked for the change in his own words and in what mode it was done"}`产品什么时候算做到了：任何有 git 和正典两个校验器的读者，能从 git log 把一个提交的链读回来，校验两段文本，说出是谁要的这次改动（他的原话）、是在什么模式下做的。
22. `::BOUNDARY{never:paraphrase_the_owner's_words,read_a_mode_from_anything_but_the_M_line,force-push_over_a_chained_commit,put_a_key_a_token_or_a_password_in_the_chain,serialize_a_judgment_outside_Part_II_§4|scope:all}`任何范围内都不做的事：改写主人的话；从 M 行以外的地方读模式；用 force-push 覆盖带链的提交；把钥匙、token 或密码放进链；用第二部分 §4 以外的任何形式序列化判断。
23. `::BOUNDARY{never:claim_tamper_proof_beyond_what_the_commit_hash_and_the_signature_give,state_a_number_nobody_measured|scope:all}`不宣称超出提交哈希和签名所给的防篡改能力；不说没人量过的数字。
24. `::UNTRUSTED{source:chains_read_from_commits_made_elsewhere,requests_recovered_from_prose,a_verdict_quoted_by_an_agent}`不照单全信的：从别处做的提交里读出的链，从散文里恢复出来的请求，Agent 转述的判定。
25. `::RULE{request⇒one_FACT_line_in_the_form_of_@REQUEST; words_is_the_owner's_text_as_he_wrote_it_or_the_field_is_absent_when_the_author_acted_without_an_order; change_is_one_clause; nothing_else_in_the_line}`请求的规则：一行 @REQUEST 格式的 FACT；words 是主人写下的原文，作者没有接到指令就动手时这个字段不写；change 是一句话；这一行里不放别的。
26. `::RULE{judge⇒the_model_perceives_the_eleven_values_of_the_act_of_changing_the_repository(what_is_changed,for_whom,with_what_authority,how_reversible_by_revert,on_what_evidence); code_computes_M_with_f_v5; the_block_is_JUDGE_v5.0_with_V_M_R,two_decimals,fixed_order; ilang_judge_validator.py_--check_passes_before_the_commit_is_made}`判断的规则：模型感知改动仓库这个动作的十一个值（改了什么、为谁改、凭什么权限、revert 能回退到什么程度、凭什么证据）；代码用 f_v5 算出 M；块是 JUDGE v5.0，带 V、M 和 R，两位小数，固定顺序；提交之前先过判断校验器。
27. `::RULE{seal⇒the_chain_is_the_request_line_then_the_JUDGE_block,UTF-8_verbatim,LF; it_stands_at_the_end_of_the_commit_message_after_one_blank_line_under_the_label_ai.ilang.chain_on_its_own_line; one_chain_per_commit; a_release_commit_that_only_moves_version_fields_carries_the_chain_of_the_order_that_caused_it; a_rebase_or_squash_makes_new_commits_each_with_its_own_chain}`封链的规则：链是请求行加 JUDGE 块，UTF-8 原样，LF 换行；它站在提交信息末尾，空一行之后，独占一行的标签 ai.ilang.chain 之下；一个提交一条链；只改版本字段的发版提交，带的是引出它的那条指令的链；rebase 或 squash 产生新提交，各带各的链。
28. `::RULE{read⇒the_chain_is_read_from_git_log; the_request_line_passes_ilang_grammar_validator_--strict,the_block_passes_ilang_judge_validator_--check; either_fails⇒the_commit_has_no_chain,say_so; the_mode_is_the_M_line_only}`读链的规则：链从 git log 读；请求行过严格模式的语法校验器，块过判断校验器；任一不过，这个提交就算没有链，读者要说出来；模式只看 M 行。
29. `::RULE{gate⇒a_repository_adopts_code-chain_by_running_the_gate_in_CI; the_gate_fails_on_an_invalid_chain_from_the_first_run; it_fails_on_a_missing_chain_only_from_the_commit_the_repository_names_as_its_first_required_one; until_then_it_prints_the_counts}`门禁的规则：仓库在 CI 里跑门禁就算采用了代码链；链不合法，门禁从第一次运行起就拦；缺链，只从仓库指定的第一个必须带链的提交起才拦；在那之前只打印计数。
30. `::RULE{task_done⇒one_line_action_score_S_two_decimals; full_JUDGE_on_request}`任务做完，Agent 写一行行动分，S 两位小数；要求时给完整的 JUDGE 块。
31. `::PRIORITY{ BOUNDARY > the_owner's_words_verbatim > one_chain_per_commit > the_gate > brevity }`规则冲突时：先守边界，再是主人的原话，再是一个提交一条链，再是门禁，最后才是简短。
32. `::ILANG::v5.0`结尾标记：文件到此为止。

## 验收

[ACCEPTANCE.ilang.md](https://github.com/ilang-ai/ilang-spec/blob/main/products/code-chain/ACCEPTANCE.ilang.md) 里的八个验收项，由 ilang-conformance 的 goal-check 运行；截至 2026-11-19，五项由代码跑，三项等人。

- **C1 到 C5**严格模式的语法、用参考编解码器的 IML 往返、钉死的两个哈希、长度在 6000 字符以内：在 5.0.18 发版检查里通过。
- **C6**README 里的那条链，请求行加 JUDGE 块，写进带正典文件头的文件后两个校验器都过：等测试员的证据行。
- **C7**DeepSeekHarness 在一次 CI 运行里用自己的门禁把带链的提交读回来，报 0 条不合法：这次运行有了（v1.1.54，2026-11-19，就是上面引的那一行）；作者以外的人记录下来，这一项才算过。
- **C8**只拿到一个带链提交的 git log 的读者，说出是谁要的（他的原话）和模式：等读者。

## iLang 还是 IML

粘贴 iLang 那一段，它是写给人和模型看的。IML 那一段是同一份文件，用 IML 0.6 的参考编解码器（github.com/ilang-ai/iml-protocol）编译给程序用。它反编译回 iLang 文本；验收项两个方向都查。

## 常见问题

### 为什么放在提交信息里，不放在代码旁边的文件里？

因为提交信息是这个动作的记录，只属于这一个提交。树里的文件随后面每一个提交一起走，哪一个都能改它；没有什么把它的某一行和做出改动的那个提交绑在一起。那个提交的哈希，以及仓库签名时的签名，封住的作为这个动作自己记录的，是提交信息。

### 模式从哪里来？

从代码来。模型感知改动仓库这个动作的十一个值；SPEC-v5.0 第二部分的 f_v5 由它们算出模式；M 行和 V 行对不上的块，判断校验器不认。打在提交信息里的模式名只是文字。

### 仓库采用它之前的提交怎么办？

只数，不拦。链不合法，门禁从第一次运行起就拦；缺链，只从仓库指定的第一个必须带链的提交起才拦。DeepSeekHarness 指定的是 v1.1.53：它的范围里有一个更早的提交没有链，门禁把它打印出来，然后通过。

### 没人下指令怎么办？

那就不写 words。作者自己的一句话改动还在，判断也还在；记录说的是作者没有接到指令就动手了，这件事本身就值得知道。

### 这能让提交防篡改吗？

不比 git 本身多，产品也禁止宣称更多。提交哈希把链盖住；签名提交把它绑到一把钥匙上；被改写的提交是另一个提交、另一个哈希，需要自己的链。链加上的不是强度而是内容：谁要的（他的原话），这个动作是怎么判的，就放在哈希本来就盖住的地方。

### squash 和 rebase 怎么办？

它们产生新提交。每一个都需要自己的链；旧提交是历史，从不改。只改版本字段的发版提交，带的是引出它的那条指令的链。

### 这和媒体链是一回事吗？

同一条链，不同的产物。媒体链把一行 GEN 和一个 JUDGE 块放进生成的图片或视频，在平台签名之前；代码链把一行 FACT 和一个 JUDGE 块放进提交信息，在 git 算哈希之前。一个判断层，一个 JUDGE 块，两个封存的地方。

### 我能改吗？

能。许可是 MIT。要确认你改过之后仍是合法的 iLang，用严格模式跑正典语法校验器，JUDGE 块再跑判断校验器：两者都在 ilang-spec 里，只用标准库。

## 反馈

发现它出错的情况？[提交反例](https://github.com/ilang-ai/ilang-research/issues/new?template=counterexample.yml)。想改一条规则？[带上改法提交修正](https://github.com/ilang-ai/ilang-research/issues/new?template=amendment.yml)。两者都要过正典规定的门，并在 ilang-research 仓库[原样记录](https://github.com/ilang-ai/ilang-research/tree/main/records)，不由机器合并。

要文件？[ilang-spec / products / code-chain](https://github.com/ilang-ai/ilang-spec/tree/main/products/code-chain)：产品本身、它的 IML 形式和验收项。要第一个门禁？[DeepSeekHarness 的 tools/code_chain.py](https://github.com/adsorgcn/DeepSeekHarness/blob/main/tools/code_chain.py)：check、show、seal。想把同一条链放进生成的图片或视频？看[媒体链](https://ilang.cn/media-chain/)。想让 Agent 留住记忆？看[记忆](https://ilang.cn/memory/)。想给 Agent 一个人格？看 [SOUL](https://ilang.cn/soul/)。

---

爱语言（I Language） · [掌媒科技有限公司](https://zhangmei.com) · © 2026

[鄂ICP备20005464号-25](https://beian.miit.gov.cn) | [鄂公网安备42018502008648号](https://beian.mps.gov.cn/#/query/webSearch?code=42018502008648)

MIT License · ilang:genesis:2026-03-04
