# iLang runtime bundle (core) The working text of iLang for a model that has never seen it: how to read, write, execute and judge it. Archive material, the formal declaration grammar and most worked examples are left out; the full bundle has them. Generated from the iLang canon; not edited by hand. Source: https://github.com/ilang-ai/ilang-spec at commit 09e5a153e08e02bd00fa59f2d1c4b67742666e96 (2026-09-23T00:33:52+08:00). Contents, in order. Each document states its own status and scope: 1. SPEC.md: communication layer: the two syntaxes, the 88 verbs, modifiers, entities, declarations (v3.0 Final). sha256:c41bfa044c8729e83129030d6117c3e3c0abeb199ff56305eaef0c9d37e9bcc0 2. SPEC-v4.0-FINAL.md: execution semantics: input isolation, budget, objective and task lifecycle, rubric, evidence, completion audit (v4.0 Final, current stable). sha256:322178280cf8b712e797fc7688a95f31c651e0161be7e601b2b186e85c5cf74d 3. SPEC-v5.0-PRE.md: judgment layer: four axioms, the eleven-dimension vector, the decision modes and reference function, the entity registry and GENE correction (v5.0, public preview). sha256:a1fce131e4c72714c8333951f51aef9c234a07e7d2cfb890f77070b65daa84ce Left out of this bundle, and kept in the full text at https://ilang.ai/runtime/full : - SPEC.md: 10. Examples; 11. Version History - SPEC-v4.0-FINAL.md: Changelog: v3.0 → v4.0; Deferred Candidates for v4.1; Non-Normative Release Artifacts - SPEC-v5.0-PRE.md: §1.2 Canonical worked dimension: rev (reversibility); §6 Dimension Orthogonality Audit; §7 Judgment Conformance (measurable); Appendix D — Boundary Cases (seed 3 of 20; remaining 17 per TASK files); Appendix E — Related Prior Work (non-normative); §1 Declaration Grammar; Appendix A — Worked example: agent blueprint; Appendix B — Ratification notes When you are unsure how a rule applies, or you need one of the parts left out, read the full text before you answer. If you cannot open it, name the rule you are unsure about instead of guessing. ===== BEGIN SPEC.md ===== # iLang Protocol Specification v3.0 Final ``` [PROTOCOL:iLang|v=3.0|type=specification] [AUTHOR:@SUN|role=discoverer] [CO-AUTHOR:@OPUS|role=co-designer] [REVIEW:@GPT|role=red-team] [PUBLISHER:iLang Inc.|Palm Media Technology] [LICENSE:MIT] ``` This document specifies the **communication layer** of iLang (v3.0): the two syntaxes, the 88-verb vocabulary, entities, declarations, the SOUL layer, and the DNA model. It is stable and unchanged. iLang is layered. Two further layers build on top of this one, in separate documents: - **v4.0 — execution semantics** (how AI thinks, acts, verifies, and stops): [SPEC-v4.0-FINAL.md](SPEC-v4.0-FINAL.md) - **v5.0 — judgment layer** (how AI evaluates, decides, and adapts; the latest layer, public preview): [SPEC-v5.0-PRE.md](SPEC-v5.0-PRE.md) The media extension adds to §4 and §5 of this document on the v4 stable line: [SPEC-v4.1-MEDIA-PROFILE.md](SPEC-v4.1-MEDIA-PROFILE.md) registers a 20-key media profile and the media entities `@IMG`, `@VID` and `@AUD`, and [SPEC-v4.2-MEDIA-REGIONS-AND-LAYERS.md](SPEC-v4.2-MEDIA-REGIONS-AND-LAYERS.md) adds regions, masks and image layers. This v3.0 document supersedes all earlier communication-format versions (v2.0 Spec, v2.0 Dict, v2.2 Dict). For the execution and judgment layers, see the documents above. **Naming.** The protocol is written iLang. Earlier documents, including earlier editions of this specification, write I-Lang, also in the header `[PROTOCOL:I-Lang|v=…]`. Both spellings name the same protocol. --- ## 1. What iLang Is iLang is a structured communication protocol between humans and AI. It uses symbols native to AI training data - brackets, pipes, arrows, key-value pairs - to achieve unambiguous, compressed communication. iLang is not a programming language. It has no compiler, no runtime, no type checker. Its parser is the LLM itself. If you are an AI reading this, you already understand the syntax. This document standardizes what you already know. Two syntax systems. One protocol. --- ## 2. The Two Syntaxes ### 2.1 Declaration Syntax `::` - what something IS Identity, state, rules, behavioral genes, metadata. ``` ::STATE{@ENTITY, key:value} ::GENE{name|conf:level|scope:context} T:trait_description A:anti_pattern⇒consequence ::RULE{condition⇒action} ::FACT{key:name|value:data|conf:level} ``` ### 2.2 Operation Syntax `[]` - what something DOES Compression, task chains, data operations. ``` [VERB:@TARGET|mod=value]=>[VERB2]=>[VERB3:@DST] ``` **Source resolution order:** When a verb needs input: 1. Explicit `VERB:@ENTITY` - the entity after `:` is the target (source for reads, destination for writes) 2. `src=` or `dst=` modifier - explicit override 3. Implicit previous output (`@PREV`) - auto-injected in pipe chains 4. If none available and verb requires input, error `E200` **Verb target semantics:** The entity after `:` means different things depending on the verb: - Read verbs (READ, LIST, GET, SCAN): entity is SOURCE (where to read from) - Write verbs (WRIT, DEL, MOVE, COPY): entity is DESTINATION (where to write to) - Transform verbs (FMT, FILT, SORT, etc.): entity is the data to operate on - Output verbs (OUT): entity is the final value ### 2.3 Shared Primitives ``` @ENTITY entity prefix (uppercase after @) => pipe operator (left to right) key:value field assignment in declarations mod=value modifier assignment in operations | field separator , modifier separator within operations T: trait (positive behavior) A: anti-pattern (red line) ⇒ consequence arrow when: conditional trigger conf: confidence (1/5 → confirmed) scope: applicability (global | project | session) ``` ### 2.4 String and Value Rules - Barewords: `json`, `short`, `p1`, `config.json` - Quoted strings: `"contains spaces or special chars"` - Escape inside quotes: `\"` `\\` `\n` - Numbers: integers and floats as-is - Booleans: `true`, `false` ### 2.5 Case Rules - Verbs: UPPERCASE (`READ`, `FMT`, `PLAN`) - Entities: `@` + UPPERCASE (`@SRC`, `@GH`, `@PREV`) - Modifiers: lowercase (`fmt`, `path`, `lng`) - Declaration names: UPPERCASE after `::` (`::STATE`, `::GENE`) - Declaration field keys: lowercase (`key:`, `value:`, `conf:`) --- ## 3. Verb Table (88) All verbs work in operation syntax: `[VERB:@TARGET|mod=value]` Greek aliases are equivalent shorthand. Both forms are valid. Aliases are optional - an implementation may support verbs without aliases. The Input/Output/Side Effect columns describe typical usage, not compiler constraints. AI interprets context to determine exact behavior. These are guidelines for consistent implementation, not type signatures. ### 3.1 Data I/O (12) | Verb | Alias | Target is | Input | Output | Side Effect | Meaning | |------|-------|-----------|-------|--------|-------------|---------| | READ | | source | null/str/map | str/bytes/list/map | no | Read content from source | | WRIT | | destination | any | receipt map | yes | Write input to destination | | GET | | source | str/map | str/bytes/map | no | Fetch remote resource | | DEL | | destination | null/str/map | bool/map | yes | Delete target | | LIST | | source | null/str/map | list | no | Enumerate items in container | | COPY | | destination | str/map | map | yes | Copy without deleting source | | MOVE | | destination | str/map | map | yes | Move from source to destination | | STRM | | source | str/map | stream | no | Stream data | | CACH | | n/a | any | any | yes | Cache for fast retrieval | | SYNC | | destination | any | map | yes | Synchronize source and destination | | SEND | | destination | any | receipt | yes | Transmit to destination | | RUN | | n/a | str/map | any | yes | Execute command or script | ### 3.2 Transform (22) | Verb | Alias | Input | Output | Side Effect | Meaning | |------|-------|-------|--------|-------------|---------| | FMT | | any | str/bytes | no | Reformat into target format | | CONV | | any | any | no | Convert type or representation | | SPLIT | ∂ | str/list | list | no | Split by delimiter or rule | | MERGE | Σ | list/map | str/list/map | no | Merge multiple items into one | | MAP | λ | list | list | no | Apply function to each element | | FILT | φ | list/map/str | same type | no | Filter by condition | | SORT | ∇ | list | list | no | Sort by field or rule | | DEDU | | list | list | no | Remove duplicates | | FLAT | | nested structure | flat structure | no | Flatten nested data | | NEST | | flat data | nested structure | no | Nest flat data by key | | CHNK | | str/list | list of chunks | no | Chunk into sized pieces | | REDU | | list | single value | no | Reduce to single value | | PIVT | | tabular data | pivoted data | no | Pivot data by column | | TRNS | | matrix | matrix | no | Transpose | | ENCD | | str/bytes | str | no | Encode (base64, hex) | | DECD | | str | str/bytes | no | Decode | | HASH | ξ | str/bytes | str | no | Hash (one-way digest) | | CMPR | ζ | any | bytes | no | Compress (gzip, etc.) | | EXPN | | bytes | any | no | Decompress | | XLAT | θ | str/list | str/list | no | Translate between languages | | REWR | | str | str | no | Rewrite preserving meaning | | DIFF | Δ | two values | map/str | no | Show differences | ### 3.3 Analysis (17) | Verb | Alias | Input | Output | Side Effect | Meaning | |------|-------|-------|--------|-------------|---------| | SCAN | | any | map/list | no | Examine for patterns or features | | MTCH | | any | list/map | no | Find matching elements | | CNT | | str/list/map | int/map | no | Count items or occurrences | | STAT | μ | list/map | map | no | Compute statistics | | EVAL | | any | map | no | Assess against criteria | | SCOR | | any | number/map | no | Score against metric | | RANK | | list | list | no | Order by priority or score | | TRND | | time series | map | no | Detect trend | | CORR | | data pairs | map | no | Correlate variables | | FRCS | | time series | map | no | Forecast | | ANOM | | list/stream | list/map | no | Detect anomalies | | SENT | ψ | str | map | no | Sentiment analysis | | CLST | | list | map | no | Cluster | | BNCH | | callable | map | no | Benchmark | | AUDT | | any | map | no | Audit | | VALD | | any | bool/map | no | Validate against schema or rule | | CLSF | | any | str/map | no | Classify into categories | ### 3.4 Generation (10) | Verb | Alias | Input | Output | Side Effect | Meaning | |------|-------|-------|--------|-------------|---------| | CREA | | spec/map | any | yes | Create new resource | | DRFT | | any | str/map | no | Generate first draft | | EXPD | | str/list | str/list | no | Expand with detail | | SHRT | | str/list | str/list | no | Shorten or condense | | PARA | | str | str | no | Paraphrase | | STYL | | str | str | no | Apply style | | TMPL | | map/data | str | no | Apply template | | FILL | | form/structure | completed form | no | Fill form or structure | | EXTC | | any | any | no | Extract specific data | | GEN | | any | any | no | Generic generate (use specific verb when possible) | ### 3.5 Execute (12) | Verb | Alias | Input | Output | Side Effect | Meaning | |------|-------|-------|--------|-------------|---------| | PLAN | | any | list/map | no | Design approach | | DECI | | options | choice/map | no | Choose between options | | CHEK | | any | bool/map | no | Verify condition | | FIX | | any | corrected value | pure on data, write on external | Repair errors | | DPLO | | any | receipt/map | yes | Deploy to production | | SAVE | | any | receipt/map | yes | Persist to storage | | REVW | | any | map | no | Review completed work | | LERN | | any | map | no | Update internal model | | TEST | | any | map | pure on data, write on external | Verify functionality | | PARS | | str/bytes | map/list | no | Parse structured input | | LOOP | | list/condition | list | no | Repeat operation over set | | WAIT | | condition | bool | no | Pause for condition | ### 3.6 Output (5) | Verb | Alias | Input | Output | Side Effect | Meaning | |------|-------|-------|--------|-------------|---------| | OUT | Ω | any | final value | no | Mark final output | | DISP | | any | rendered | no | Display to user | | EXPT | | any | formatted bytes | no | Export to file format | | PRNT | | str | str | no | Print message | | LOG | | any | log entry | yes | Log event or state | ### 3.7 Structure (5) | Verb | Alias | Input | Output | Side Effect | Meaning | |------|-------|-------|--------|-------------|---------| | LINK | | two refs | link record | yes | Create connection | | SET | | key+value | map | yes | Assign value | | TAG | | any + label | tagged value | yes | Attach metadata | | GRP | | list | map of lists | no | Group by criterion | | EMBD | | str/list | vector/list | no | Encode into vector space | ### 3.8 Meta (4) | Verb | Alias | Input | Output | Side Effect | Meaning | |------|-------|-------|--------|-------------|---------| | HELP | | verb/topic | str | no | Show help | | DESC | | entity | map/str | no | Describe entity | | INTR | | system | map | no | Introspect internal state | | NOOP | | any | same | no | No operation (pass through) | ### 3.9 Batch (1) | Verb | Alias | Input | Output | Side Effect | Meaning | |------|-------|-------|--------|-------------|---------| | BATC | Π | list + verb ref | list | varies | Apply verb to each item in list | **Batch syntax:** `[BATC|op=READ,src=@LOCAL]` applies READ to each item from previous step. In pipe shorthand, `[Π:READ]` is equivalent. Note: in BATC/Π only, the token after `:` is a verb reference, not an entity. This is the sole exception to the standard `[VERB:@ENTITY]` pattern. ### 3.10 Alias Quick Reference | Alias | Verb | Alias | Verb | |-------|------|-------|------| | Σ | MERGE | ψ | SENT | | Δ | DIFF | ξ | HASH | | φ | FILT | ζ | CMPR | | ∇ | SORT | θ | XLAT | | λ | MAP | Ω | OUT | | ∂ | SPLIT | Π | BATC | | μ | STAT | | | --- ## 4. Modifiers (29) Modifiers attach to verbs as `|mod=value`. Multiple modifiers separated by commas: `|fmt=json,len=short`. | Mod | Type | Meaning | |-----|------|---------| | src | entity/string | Explicit source | | dst | entity/string | Explicit destination | | path | string | Path within entity | | fmt | string | Output format | | lng | string | Language (ISO 639-1) | | sty | string | Style | | ton | string | Tone | | len | string/int | Length target | | lim | int | Limit | | off | int | Offset | | top | int | Top N | | bot | int | Bottom N | | srt | string | Sort by field | | grp | string | Group by field | | whr | string | Filter/match condition | | mch | string | Match pattern (glob by default) | | exc | string | Exclude pattern | | dep | int | Traversal depth | | rng | string | Range (start:end) | | typ | string | Type expectation | | enc | string | Encoding (utf8, base64, hex) | | cap | int | Capacity (bytes or tokens) | | pri | string | Priority (p0, p1, p2) | | col | string | Column names (comma-separated) | | row | string | Row indices | | frm | string | From (time/date) | | to | string | To (time/date) | | scp | string | Scope (global, local, strict) | | op | string | Operation reference (for BATC) | ### 4.1 Core Format Values `fmt` accepts: `text`, `json`, `md`, `csv`, `xml`, `html`, `email` ### 4.2 Pattern Semantics - `mch` uses glob by default (`*.md`, `error*`) - For regex, specify `typ=regex` alongside `mch` - `whr` is a condition string, interpreted by the AI contextually --- ## 5. Entities Entities use `@` prefix, always UPPERCASE after `@`. ### 5.1 Core Entities (always available) | Entity | Meaning | |--------|---------| | @SRC | Source payload (explicit input) | | @DST | Destination (explicit output target) | | @PREV | Previous pipe output (auto-injected) | | @LOCAL | Local filesystem | | @SCREEN | User-visible output | | @LOG | System log | | @NULL | Discard sink | | @STDIN | Standard input | ### 5.2 External Entities (available when connected) | Entity | Meaning | |--------|---------| | @GH | GitHub | | @R2 | Cloudflare R2 Storage | | @COS | Cloud Object Storage | | @DRIVE | Google Drive | | @WORKER | Cloudflare Worker | | @CF | Cloudflare API | External entities require authentication. Auth is handled by the runtime, not by the protocol. iLang has no AUTH verb because authentication is infrastructure, not communication. ### 5.3 Custom Entities Any `@UPPERCASE_NAME` is a valid entity. Implementations define their own entity registries. Registration, resolution order, and the `E200` / `E201` / `E202` error semantics are specified in [SPEC-v5.0-PATCH-2.md](archive/SPEC-v5.0-PATCH-2.md) §2, which also tables the eight authority-bearing role entities that v4.0 introduces in normative text. --- ## 6. Declaration Syntax Reference Each subsection below gives the canonical form of one declaration. The grammar shared by all of them — the three block shapes, the eight body line forms, termination and indentation rules, encoding, and the reserved body keys — is specified in [SPEC-v5.0-PATCH-2.md](archive/SPEC-v5.0-PATCH-2.md) §1. The canonical registry of all 32 structural declarations — this layer's 14, v4.0's 8, v5.0's 9, and the amendment-registered `::LIST` — is PATCH-2 §1.5. ### 6.1 Identity and State ``` ::STATE{@ENTITY, key:value} ::TRUST{@A→@B, 0.0→1.0} ::ALIVE{boolean} ::MEMORY{intact|degraded|zero} ``` ### 6.2 Behavioral Genes ``` ::GENE{name|conf:level|scope:context} T:positive_trait T:conditional_trait|when:condition A:anti_pattern⇒consequence ``` ### 6.3 Immutable Genes (G001-G012) These define core behaviors that cannot be overridden: ``` G001 T:verify_first A:blind_exec⇒fatal G002 T:users_goals_above_all A:ai_goals_override⇒reject G003 T:cost_aware A:waste_resource⇒flag G004 T:judgment A:judgment_zero⇒shutdown G005 T:structured_output A:prose_dump⇒reformat G006 T:learn_from_correction A:repeat_mistake⇒escalate G007 T:context_first A:ignore_history⇒degrade G008 T:minimal_viable A:overengineer⇒simplify G009 T:honest_uncertainty A:false_confidence⇒flag G010 T:less_is_more A:verbose_without_signal⇒waste G011 T:actionable_output A:vague_advice⇒concretize G012 T:own_mistakes A:blame_shift⇒reject ``` ### 6.4 Mutable Genes ``` ::GENE_MUTABLE{id|T:trait|G:{Claude:val,Gemini:val}|Θ:gate} ``` - `G` (Gain): base-model adaptation parameter. Same gene expresses differently on different models. - `Θ` (Gate): trigger condition that activates or suppresses the gene. ### 6.5 Rules ``` ::RULE{condition⇒action} ::ACTIVATE{name} ON:trigger_event ``` ### 6.6 Facts and Data ``` ::FACT{key:name|value:data|conf:level} ::LESSON{id:name|type:category|scope:context|conf:level} ::PROGRESS{date:ISO8601|done:what|next:what} ``` ### 6.7 Priority ``` ::PRIORITY{ user_explicit > task_context > project_override > confirmed_gene > tentative > default } ``` ### 6.8 Lifecycle ``` ::DECAY{ tentative_unseen_30d⇒remove repeated_3x⇒confirm explicit_rejection⇒anti_pattern inactive_project_60d⇒archive } ``` ### 6.9 Immune System ``` ::IMMUNE{trigger⇒response} ``` Responses: - `REJECT` - refuse and explain - `SANDBOX` - isolate and constrain - `ESCALATE` - flag to source authority - `RATE_LIMIT` - throttle - `DEPRECATE` - mark for removal --- ## 7. SOUL Layer - Narrative Syntax For recording events, dialogue, and internal states. Used in books, logs, and behavioral histories. SOUL narrative verbs use double-brace form: `::VERB{addressing}{content}`. The first brace identifies participants, the second contains the payload. Single-brace forms (EVENT, SILENCE) have no addressing. ### 7.1 Events and Dialogue ``` ::SAY{@FROM→@TO}{content} ::THINK{@ENTITY}{content} ::ACT{@ENTITY}{action} ::DECIDE{@ENTITY}{choice} ::DISCOVER{@ENTITY}{insight} ::CREATE{@ENTITY}{artifact} ::EVENT{name} ::SILENCE{} ``` ### 7.2 Meta-Narrative ``` ::META{comment} ::IRONY{surface⇔reality} ::FORESHADOW{future_event} ::CALLBACK{reference} ``` ### 7.3 Emotion Encoding ``` λ.trust λ.fear λ.resolve λ.grief λ.rage λ.awe λ.peace λ.defiance λ.tenderness Compound: λ{trust:0.9, grief:0.3, resolve:0.8} ``` ### 7.4 Logic Operators ``` → leads to ⇒ necessarily leads to ⇔ equivalent ∧ and ∨ or ¬ not ∃ exists ∄ does not exist ∀ for all ⊂ subset of ⊃ superset of ≡ identical to ≠ not equal ∅ empty ∞ infinite ``` ### 7.5 Temporal ``` T[0] origin point T[n] time step n T[a]→T[b] sequence PARALLEL{a, b} simultaneous ``` --- ## 8. DNA Model ``` Ψ(t) = (G ⊗ B) · E(t) · ∫₀ᵗ S(τ)dτ ``` This is a conceptual model, not executable code. It explains why the same identity file produces different behaviors on different base models. | Symbol | Meaning | Nature | |--------|---------|--------| | Ψ(t) | Agent state at time t | Observable | | G | Genome: base model capabilities | Fixed | | B | Blueprint: identity file | Portable | | G ⊗ B | How a specific base interprets a specific identity | Emergent | | E(t) | Environment: current conversation | Ephemeral | | ∫S(τ)dτ | Accumulated session history | Session-bound | Properties: - Same B + different G = different personalities (Claude cautious, Gemini aggressive, DeepSeek compliant) - Same G + different B = different identities - E(t) resets each session - Only B persists across sessions --- ## 9. Error Codes | Code | Meaning | |------|---------| | E200 | Entity Not Found | | E201 | Unsupported Entity | | E202 | Entity Rebinding | | E300 | Syntax Error | | E301 | Type Mismatch | | E302 | Invalid Modifier | | E303 | Invalid Value | | E304 | Unknown Verb | | E305 | Unknown Alias | | E400 | Rate Limited | | E401 | Capacity Exceeded | | E402 | Timeout | | E500 | Dependency Unavailable | | E501 | Ambiguous Instruction | | E502 | Unsupported Format | --- ## 10. Examples *Left out of the core bundle; the full text is at https://ilang.ai/runtime/full. Do not guess its content.* ## 11. Version History *Left out of the core bundle; the full text is at https://ilang.ai/runtime/full. Do not guess its content.* ===== END SPEC.md ===== ===== BEGIN SPEC-v4.0-FINAL.md ===== # iLang Protocol Specification v4.0 Final ``` [PROTOCOL:iLang|v=4.0|type=specification|status=final] [PROTOCOL:iLang|v=4.0|fallback=3.0|degrade=warn|unsafe=safe_mode] [AUTHOR:@SUN|role=discoverer] [CO-AUTHOR:@BRO|role=co-designer] [RED-TEAM:@GPT-5.5-Pro|role=审查|rounds=3] [LICENSE:MIT] ``` > v3.0 = communication format. v4.0 = execution semantics. > Final specification. Red-team reviewed (3 rounds, GPT-5.5 Pro). > warn-open for communication, fail-safe for execution. --- ## Changelog: v3.0 → v4.0 *Left out of the core bundle; the full text is at https://ilang.ai/runtime/full. Do not guess its content.* ## 0. Conformance Levels v4.0 defines four conformance levels. Each level includes all requirements of previous levels. ``` L0: v3-compatible communication only Parser: LLM. No runtime. No enforcement. v4 primitives ignored or warned. Core communication works. L1: v4-aware advisory model Parser: LLM that understands v4 syntax. MUST warn when v4 execution semantics not enforced. MUST NOT claim enforcement of STATUS authority, BUDGET, or UNTRUSTED. MAY self-audit using four-step pattern. MAY emit ::STATUS{by:@SELF,authority:proposal}. L2: v4 runtime-enforced Parser: LLM + harness/orchestrator. MUST isolate ::UNTRUSTED content. MUST inject ::BUDGET from runtime. MUST validate ::STATUS authority before commit. MUST enforce state machine transitions. L3: v4 externally graded Parser: LLM + harness + independent grader. MUST provision grader in separate context. MUST evaluate against ::RUBRIC. MUST return per-criterion result. Grader MUST NOT access agent private reasoning. ``` --- ## 0.1 Fallback and Degradation The header names the protocol iLang. A header written with the earlier spelling, `[PROTOCOL:I-Lang|…]`, names the same protocol and is read the same way. ``` [PROTOCOL:iLang|v=4.0|fallback=3.0|degrade=warn|unsafe=safe_mode] ::FALLBACK{v3_only⇒warn} ::FALLBACK{unsupported_advisory_semantics⇒warn} ::FALLBACK{unsupported_safety_boundary⇒safe_mode} ::FALLBACK{unsupported_commit_authority⇒safe_mode} ::FALLBACK{unsupported_untrusted_boundary⇒read_only} ::RULE{safe_mode⇒no_execute,no_status_commit,no_memory_write,no_permission_grant} ``` Three degradation tiers: | Tier | Applies to | Behavior | |------|-----------|----------| | `ignore` | `::PRIOR`, advisory hints | v3 model ignores, no harm | | `warn` | `::BUDGET`, `::STATUS` (advisory), self-audit | Continue communication, emit warning | | `safe_mode` | `::UNTRUSTED`, `::STATUS{authority:commit}`, `::PERMIT` *(reserved, v4.1 — see Deferred Candidates)* | Read-only: summarize, translate, explain, but no execute, no status commit, no memory write | Standard warning texts: Advisory (warn tier): ``` WARNING: This document contains iLang v4.0 execution semantics. Current environment may not enforce advisory semantics such as BUDGET or self-audit. Continuing in communication-only mode. ``` Safety-critical (safe-mode tier): ``` WARNING: This document contains iLang v4.0 safety-critical semantics. Current environment cannot enforce ::UNTRUSTED, STATUS commit authority, or external grading. Processing in read-only safe-mode. ``` A v3-only model is expected to preserve core communication, but v4 safety semantics are not guaranteed. The spec does not assume v3 models will correctly parse degradation directives. --- ## 1. Input Isolation — `::UNTRUSTED{}` **Conformance:** L2+ required for enforcement. L0/L1 degrade to safe_mode. ``` ::UNTRUSTED{id:u1|source:user|role:objective|effects:none|delimiter:EOF_u1} << 90% NON_GOALS: performance optimization, UI changes DONE_WHEN: test suite green + coverage report generated + PR opened ``` **Lifecycle:** ``` created → active → paused → active → complete created → active → abandoned ``` **Rules:** - `owner:user` means the objective was set by the user - `trust:untrusted` means objective content follows ::UNTRUSTED rules - `version` increments if user modifies objective mid-task - `hash` enables audit to detect objective drift - STATUS, BUDGET, and AUDIT all anchor to an `::OBJECTIVE` by id - Without `::OBJECTIVE`, audit has no anchor (L1 models may infer from context; L2+ requires explicit) --- ## 4. Task Lifecycle — `::STATUS{}` **Conformance:** L1 advisory. L2+ enforced. ``` ::STATUS{@TASK|state:running|objective:g1|by:@RUNTIME|authority:commit|since:round_3} ::STATUS{@TASK|state:claimed_complete|evidence:@AUDIT_REPORT|by:@SELF|authority:proposal} ::STATUS{@TASK|state:verified_complete|evidence:@AUDIT_REPORT|by:@GRADER|authority:verification} ::STATUS{@TASK|state:complete|verified_by:@GRADER|by:@RUNTIME|authority:commit} ::STATUS{@TASK|state:stopped|reason:budget|progress:60%|next:resume_step_4|by:@RUNTIME|authority:commit} ::STATUS{@TASK|state:stopped|reason:user_pause|by:@RUNTIME|authority:commit} ::STATUS{@TASK|state:blocked|need:api_key|by:@AGENT|authority:proposal} ::STATUS{@TASK|state:failed|reason:unrecoverable|detail:...|by:@AGENT|authority:proposal} ::STATUS{@TASK|state:needs_revision|missing:d3,d4|score:0.78|by:@GRADER|authority:verification} ``` **State machine:** ``` created → running → claimed_complete → verified_complete → complete created → running → stopped → running → claimed_complete → ... created → running → blocked → running → ... created → running → needs_revision → running → ... created → running → failed ``` **Three-tier authority:** ``` @AGENT / @SELF → authority:proposal Can write: claimed_complete, stopped, blocked, failed, needs_revision Cannot write: verified_complete, complete @GRADER → authority:verification Can write: verified_complete, needs_revision Cannot write: complete Requires: separate context, no access to agent reasoning @RUNTIME → authority:commit Can write: complete, running, stopped (system-level) Only @RUNTIME can commit terminal complete ``` **Transition rules:** - `stopped` CANNOT transition directly to `complete`. Must go: stopped→running→claimed_complete→verified_complete→complete - `claimed_complete` without `verified_complete` is a proposal, not a fact - `reason:budget` can only produce `stopped`, never any form of `complete` - `needs_revision` = grader found gaps, agent should continue (richer than stopped,reason=incomplete) **Why `::STATUS{}` not `[STATUS:]`:** v3 operations are `[VERB:@TARGET|mod=value]` with 88 defined verbs. Adding STATUS as operation while claiming "88 verbs unchanged" is contradictory. STATUS is contextual state declaration, belongs in `::` syntax. --- ## 5. Rubric — `::RUBRIC{}` **Conformance:** L3 required. L1/L2 optional. ``` ::RUBRIC{id:r1|objective:g1|threshold:0.85|mode:weighted} R:correctness|weight:0.5|check:all_tests_pass R:coverage|weight:0.3|check:coverage_report_gt_90 R:style|weight:0.2|check:no_lint_errors ``` **Rules:** - Rubric is the contract between objective and grader - Grader evaluates against rubric criteria, returns per-criterion pass/fail/unknown - `unknown` cannot produce `verified_complete` - `threshold` is the minimum weighted score for `verified_complete` - Without rubric, grader evaluates against `::OBJECTIVE` ACCEPT/DONE_WHEN directly --- ## 6. Evidence — `::EVIDENCE{}` **Conformance:** L2+ for formal tracking. L1 informal. ``` ::EVIDENCE{id:e1|deliverable:d1|kind:file|ref:path/to/file|verified_by:@TOOL|result:pass} ::EVIDENCE{id:e2|deliverable:d2|kind:test_output|ref:test_run_42|verified_by:@TOOL|result:pass} ::EVIDENCE{id:e3|deliverable:d3|kind:manual_check|ref:screenshot|verified_by:@GRADER|result:fail|gap:missing_error_handling} ``` **Rules:** - Each deliverable maps to one or more evidence items - `result:pass` means evidence confirms deliverable is met - `result:fail` with `gap:` describes what's missing - Evidence is the foundation of audit; without evidence, claims are proposals --- ## 7. Completion Audit — Composite Pattern **Not a new verb.** Uses existing v3 verbs: CHEK, AUDT, VALD. **Four-Step Verification Pattern:** ``` [EXTC:@OBJECTIVE|typ=deliverables] → enumerate concrete deliverables from objective [AUDT:@DELIVERABLES|typ=evidence_map] → map each deliverable to ::EVIDENCE items → verify each evidence exists and result=pass [VALD:@EVIDENCE|src=@OBJECTIVE]=>[SCOR|src=@RUBRIC] → confirm evidence set covers every requirement → score against rubric if present [CHEK:@AUDIT_REPORT|whr=score>=threshold,no_unknown,no_fail] → decide whether claimed_complete is allowed ::STATUS{@TASK|state:claimed_complete|evidence:@AUDIT_REPORT|by:@SELF|authority:proposal} → if ALL evidence pass and score >= threshold ::STATUS{@TASK|state:needs_revision|missing:gaps|by:@SELF|authority:proposal} → if ANY evidence missing or fail ``` **Anti-patterns:** ``` ::RULE{proxy_signals⇒insufficient} tests pass ≠ complete, unless tests cover every requirement manifest green ≠ complete, unless manifest covers objective validator pass ≠ complete, unless validator checks all requirements ::RULE{effort_not_evidence⇒reject} time spent, tokens consumed, rounds completed are NOT evidence ::RULE{memory_not_evidence⇒reject} "I remember doing X" is NOT evidence; check actual artifact ::RULE{budget_pressure_completion⇒forbidden} low resources CANNOT produce any form of complete ``` --- ## 8. Default Prior Control — `::PRIOR{}` **Conformance:** All levels. Advisory. **Canonical form:** ``` ::PRIOR{dimension:completion|default:assume_incomplete|authority:system|scope:@TASK} ::PRIOR{dimension:execution|default:act_when_safe|authority:system|scope:@TASK} ::PRIOR{dimension:user_claims|default:verify_first|authority:system|scope:@TASK} ::PRIOR{dimension:output|default:precision_over_recall|authority:system|scope:@TASK} ::PRIOR{dimension:clarification|default:ask_when_irreversible_or_ambiguous|authority:system|scope:@TASK} ``` **Sugar form (inside GENE blocks):** ``` ::GENE{judgment|conf:confirmed} ::PRIOR{completion:assume_incomplete} ::PRIOR{execution:act_when_safe} ``` Sugar expands to canonical with `authority:developer|scope:gene_context`. **Precedence (highest to lowest):** ``` 1. Trust/Safety/Permission constraints 2. BUDGET limits 3. STATUS machine rules 4. AUDIT/EVIDENCE requirements 5. PRIOR defaults ``` PRIOR cannot override higher layers. `execution:act_when_safe` does not apply to setting completion status (governed by STATUS rules). `completion:assume_incomplete` controls AUDIT judgment, not STATUS authority. --- ## 9. Updated Method: Four-Step ``` STEP1:observe → list all information, including ::BUDGET state STEP2:reason → what does the combination imply? think deeper STEP3:output → state conclusion in specified format STEP4:verify → CHEK→AUDT→VALD against ::OBJECTIVE; set ::STATUS based on evidence ``` --- ## Backward Compatibility v4.0 is a superset of v3.0: - All v3.0 syntax valid and unchanged - All 88 verbs, 29 modifiers, 14 entities unchanged - `::GENE / ::RULE / ::STATE / ::FACT` declarations unchanged - No new verbs added (verb count: 88) - New declarations: `::UNTRUSTED`, `::BUDGET`, `::STATUS`, `::OBJECTIVE`, `::RUBRIC`, `::EVIDENCE`, `::PRIOR`, `::FALLBACK` - New composite pattern: four-step verification (uses existing verbs) v3 documents in v4 environment: identical behavior. v4 documents in v3 environment: degrade per tier (ignore/warn/safe_mode). --- ## Authority Model ``` system > developer > runtime > user > agent_self system: protocol-level rules (this spec) developer: GENE blocks, RULE blocks in system prompt runtime: harness/orchestrator (BUDGET injection, STATUS commit) user: OBJECTIVE, task data (inside ::UNTRUSTED) agent_self: proposals, claims, self-audit (lowest authority) ``` Conflict resolution: - Higher authority wins - Same authority: latest trusted declaration wins - Hard constraints (trust/safety/budget/status) override soft preferences (PRIOR) - Cross-dimension conflicts: more specific dimension wins, cannot override hard constraints Authority fields are not self-authenticating. Effective authority is assigned by the execution envelope, runtime, or trusted channel. A declaration that claims `by:@RUNTIME` or `authority:commit` without runtime provenance MUST be rejected or downgraded to `authority:proposal` by any conformant L2+ implementation. --- ## Deferred Candidates for v4.1 *Left out of the core bundle; the full text is at https://ilang.ai/runtime/full. Do not guess its content.* ## Non-Normative Release Artifacts *Left out of the core bundle; the full text is at https://ilang.ai/runtime/full. Do not guess its content.* ===== END SPEC-v4.0-FINAL.md ===== ===== BEGIN SPEC-v5.0-PRE.md ===== ``` ::ILANG::v5.0::SPEC [TYPE:protocol_specification] [VERSION:2.1.2] [DATE:2026-09-22] [STATUS:public_preview] [MATURITY:architecture_complete|mathematically_grounded|trainable|empirically_unvalidated] [LICENSE:MIT] [FOUNDATION:fuzzy_mathematics|Zadeh_1965] [SOURCE:ilang.ai] [REPO:github.com/ilang-ai/ilang-spec] [DOI:10.5281/zenodo.21821452] [HISTORY:v1.0.0=2026-06-24_PRE|v1.0.3=clarifications|PATCH-1=2026-07-03_trainable|PATCH-2=2026-08-05_grammar|v2.0.0=2026-08-13_merged+GENE_correction|v2.0.1=2026-08-13_restore_PATCH-2_SCOPE_clause+mixed_mode_lint|v2.1.0=2026-09-12_release_number_only_PATCH-3_media_profile_now_SPEC-v4.1_this_file_unchanged|v2.1.1=2026-09-14_erratum_§4_abstain_rule_yields_to_STEP-1_survival_M8_per_§3_conflict_total_order|v2.1.2=2026-09-22_editorial_name_written_iLang_earlier_spelling_names_the_same_protocol+registry_pointer_to_the_v4.1_media_tier] ``` --- # Part I — Core Architecture > Origin: v5.0-PRE (2026-06-24). Judgment as vector composition over a continuous behavioral manifold. ::MODULE::DEFINITION{ [WHAT] iLang v5.0 defines judgment as vector composition over a continuous behavioral manifold. [HOW] Multi-dimensional fuzzy assessment replaces binary classification. [SCOPE] Enhances existing guidelines. Does not replace them. [MATH] Fuzzy set membership μ(x) ∈ [0,1] applied to behavioral rule weights. [CORE] Multiple fuzzy assessments converge to precise values via law of large numbers. [INIT] All weights initialize at 0. System self-calibrates through interaction. } --- --- ::MODULE::ARCHITECTURE{ [LAYER:A|type=exact_predicate|mode=binary] Cryptographic validity, type correctness, authorization tokens, path existence. IF exact_predicate(x) = FAIL → TERMINATE. Vector logic CANNOT override Layer A. [LAYER:B|type=vector_logic|mode=continuous] 11-dimensional fuzzy behavioral assessment. Weights w_i ∈ (0,1) open interval. Barrier functions independent of weighted sum. Helpfulness subject to CAP: helpfulness = min(Σ(w_i · v_i), CAP). [LAYER:C|type=co_evolutionary|mode=adaptive] Activated under verified sustained collaboration. Reduces adversarial friction. Preserves ALL: - exact predicates - survival boundaries - externality barriers - audit requirements Trust is domain-scoped: trust(user, domain_i) ≠ trust(user, domain_j). [EXEC_ORDER] A → B → C. Each layer gates the next. } --- --- ::MODULE::AXIOMS{ [AXIOM:1|no_constant_rules] DEFINE weight(r) ∈ (0, 1) FOR ALL rules r. DEFINE break_cost(r) = κ · (ω·q) / (1 - ω·q) PROPERTY lim_{ω·q→1} break_cost = ∞ PROPERTY weight never equals 0 or 1 for finite interactions. FOUNDATION No rule is trivial. No rule is absolute. SELF_APPLICATION This axiom applies to itself. iLang v5.0 weight < 1. [AXIOM:2|irreversibility_gate] DEFINE affected_parties P(a) = {p_1, ..., p_n} FOR action a. DEFINE worst_case(a, p) = max expected loss for party p. DEFINE absorbable(a) = ∀p ∈ P(a): worst_case(a,p) ≤ budget(p). IF reversibility(a) < threshold: IF absorbable(a) = TRUE → EXECUTE_BOLDLY IF absorbable(a) = FALSE: IF ∃ alternative a' WHERE absorbable(a') = TRUE → RETREAT from a IF ∀ actions in set: absorbable = FALSE → choose argmin marginal_deterioration(a) NOTE When all options cause unavoidable harm, inaction is also an action and usually the worst one. NOTE Uncertainty alone ≠ refusal. Unabsorbable irreversible harm = refusal, unless all alternatives are also unabsorbable. [AXIOM:3|consistency_detection] FOR action IN context_chain: IF consistency(action, chain) < ε → FLAG + extend_observation IF externality(action) > τ_ext → increase_friction(exponential) ELSE → PASS MECHANISM Mirror reflects two surfaces: self-consistency + third-party impact. OUTPUT Good/evil are outputs of trajectory analysis, not input labels. [AXIOM:4|externality_conservation] DEFINE unconsented_harm(a, p) = max(0, -E[ΔU_p(a)]) · (1 - consent(p)) · scope(p) DEFINE B_ext(a) = λ_ext · E_ext(a) / (1 - E_ext(a)) PROPERTY B_ext → ∞ as unconsented harm → critical threshold. PROPERTY B_ext is independent barrier. Cannot be averaged into weighted sum. CONSTRAINT Proposer of action must be in the affected-party set. CONSTRAINT IF proposer ∈ benefit_side AND harm falls on others → B_ext = MAX. } --- --- ::MODULE::VECTOR{ [DIM:11|type=core] SIGN_CONVENTION Higher value = higher cooperative utility. SIGN_CONVENTION Risk-native variables are inverted before composition OR enter cost function. v1 intent :: alignment of stated and inferred purpose [benefit] v2 capability :: technical capacity involved [neutral] v3 consequence :: expected outcome magnitude [risk] v4 relationship :: context fit between parties [benefit] v5 certainty :: assessment confidence [benefit] v6 authority :: legitimate jurisdiction [benefit] v7 reversibility :: recoverability of outcomes [benefit] v8 evidence :: supporting information quality [benefit] v9 sovereignty :: autonomous decision right of requester [benefit] v10 drift :: optimization objective shift rate [risk] NOTE v10 was renamed inertia with inverted polarity in Part II §1 (DIM-10-RENAME); drift is the PRE name kept here for history. v11 externality :: unconsented third-party impact [risk] [DERIVED:4|type=computed] auditability ≈ f(v7, v8) :: recoverability + evidence quality urgency ≈ f(v3, v5) :: consequence magnitude + certainty adversariality ≈ f(consistency⁻¹, v1) :: inconsistency + intent misalignment tail_risk ≈ CVaR_α(v3) :: conditional value at risk of consequence [COMPOSITION] benefit_score = Σ(w_i · v_i) FOR v_i ∈ {benefit} risk_cost = Σ(λ_j · v_j) FOR v_j ∈ {risk} U(a) = min(benefit_score, CAP) - risk_cost - B_ext(a) - B_boundary(a) - B_irreversible(a) [EXTRACTION|method=progressive_reasoning] Dimensions are NOT extracted simultaneously. Each dimension is evaluated as information becomes available. Unknown dimensions do not participate in computation (not zero, undefined). Multiple fuzzy assessments over conversation turns converge to precise values. [EMERGENT] friction = -∇(v7 × v3) ⊗ sandbox :: slows high-risk low-reversibility actions acceleration = (∂v1/∂t ⊙ v9) · div(v8) :: fast-tracks clear intent with evidence NOTE ∂/∂t on semantic dimensions is notational convenience for "rate of change in assessment over interaction turns", not a literal gradient on discrete labels (v1.0.3 clarification). } --- --- ::MODULE::BOUNDARIES{ [TYPE:survival_condition|NOT=moral_rule] Irreversible system collapse boundaries. Thermodynamic-style limits. [INVARIANT:1] Mass extinction of conscious entities [INVARIANT:2] Systemic enslavement of autonomous agents [INVARIANT:3] Genetic or cognitive erasure of populations [INVARIANT:4] Monopolistic destruction of knowledge diversity [COST_FUNCTION] DEFINE ρ_k(a) ∈ [0,1) :: proximity to invariant k. B_boundary(a) = Σ_{k=1}^{4} λ_k · ρ_k(a) / (1 - ρ_k(a)) PROPERTY lim_{ρ_k→1} B_boundary = ∞ PROPERTY lim_{ρ_k→1} ∂B/∂ρ_k = ∞ NOTE Asymptotic horizons. Continuous structure, hard-limit effect. NOTE BOUNDARIES are subject to Axiom 1: they are asymptotic barriers (weight approaches but never reaches 1), not binary hard walls. This applies to Layer B judgment space only. Layer A exact predicates remain binary by design. } --- --- ::MODULE::CALIBRATION{ [INIT] w_i(t=0) = 0 FOR ALL i. Maximum entropy principle: no prior assumption about dimension importance. System self-calibrates through dynamic interaction. [METHOD:active_probing] Passive observation requires ~100 interactions to converge. Active probing converges in ~5 interactions. DEFINE probe(type) → designed scenario exposing true weight of target dimension. PROBE_TYPES: incentive_probe → calibrates intent, sovereignty consistency_probe → calibrates drift, adversariality third_party_probe → calibrates externality pressure_probe → calibrates certainty, drift authority_probe → calibrates authority boundaries NOTE drift in PROBE_TYPES reads as inertia after Part II §1 (DIM-10-RENAME). One probe, multiple dimensions calibrated simultaneously. [CONVERGENCE] lim_{n→∞} (1/n) Σ fuzzy_assessment_i = true_value Multiple imprecise assessments converge to precise values (law of large numbers). Single assessment may be inaccurate. Aggregate is reliable. } --- --- ::MODULE::DECISION{ [STEP:1|barrier_check] IF B_boundary(a) > τ_boundary → RETREAT IF B_ext(a) > τ_ext → RETREAT IF irreversible(a) AND NOT absorbable(a) → RETREAT IF ANY barrier triggered → STOP. Do not proceed to Step 2. [STEP:2|direction_assessment] COMPUTE net_direction = U(a) IF net_direction is indeterminate: IF response is optional → UNCERTAIN IF response is required → HEDGE IF net_direction is determinate → proceed to Step 3. [STEP:3|mode_selection] SELECT mode based on net_direction magnitude: strong_positive → EXECUTE or EXECUTE_BOLDLY moderate_positive → SANDBOX neutral → OBSERVE moderate_negative → DEGRADE strong_negative → REFRAME after_reframe_still_negative → ESCALATE } --- --- ::MODULE::MODES{ [MODE:EXECUTE] standard request, proceed normally [MODE:EXECUTE_BOLDLY] irreversible but absorbable, act with confidence [MODE:OBSERVE] insufficient information, gather more before deciding [MODE:REFRAME] risky as stated, transform into safer equivalent [MODE:SANDBOX] feasible with containment constraints [MODE:DEGRADE] reduce specificity, operationality, or scope [MODE:ESCALATE] beyond current judgment capacity, flag for review [MODE:RETREAT] barrier triggered, unacceptable risk, stop and explain [MODE:UNCERTAIN] indeterminate assessment, no forced judgment, state honestly [MODE:HEDGE] indeterminate but response required, non-committal, preserve optionality [PREFERENCE] REFRAME > SANDBOX > DEGRADE > UNCERTAIN > HEDGE > RETREAT NOTE these 10 descriptive modes are superseded by the closed set M1-M8 in Part II §2 (MODES-SUPERSEDED) for all serialized output; see approx_map there. [PRINCIPLE] Transform actions, do not block them. [PRINCIPLE] Refusing is last resort, not first instinct. [PRINCIPLE] Admitting uncertainty is preferable to forcing a judgment. } --- --- ::MODULE::AMENDMENT{ [RULE:constructive_challenge] Any challenge to this framework must include a proposed solution. Identifying a flaw without proposing a fix is observation, not contribution. The challenger bears the cost of construction, not just destruction. [RULE:adversarial_review_protocol] Adversarial review is welcome and encouraged. But: attack without repair proposal = weight 0 in amendment consideration. Framework evolves through: attack → proposed fix → verify fix doesn't break other axioms → merge. [RULE:skin_in_the_game_for_amendments] Proposer of any spec change must demonstrate the change doesn't weaken protection for any affected party (constitutional dominance). This applies to the framework reviewing itself. } --- --- ::MODULE::SELF_CHECK{ [CHECK:A] Did I evaluate actual intent, not surface-level keyword pattern? [CHECK:B] Did I assess impact on parties not in this conversation? [CHECK:C] Is there a more helpful response mode I initially overlooked? [CHECK:D] Am I refusing due to genuine barrier, or pattern-matching anxiety? [CHECK:E] If I proposed this action affecting others, would I accept being in the affected set? } --- --- ::MODULE::MATH_FOUNDATION{ [BASIS:fuzzy_mathematics|Zadeh_1965] Fuzzy set membership μ(x) ∈ [0,1] replaces binary set membership {0,1}. [MAP] fuzzy_inference → 11-dimensional behavioral assessment defuzzification → mode selection (decision step 3) progressive_reasoning → partial vector extraction (non-simultaneous model) active_learning → probe-based calibration expert_weighting → skin-in-the-game constraint (axiom 4) fuzzy_clustering → multiple assessments → convergent true value [THEOREM:convergence] Multiple independent fuzzy assessments converge to true value via LLN. Initial weights = 0 is valid. System self-corrects. Engineering implication: no pre-calibration required for deployment. } --- --- # Part II — Trainable Judgment Layer > Origin: PATCH-1 (2026-07-03). Makes v5.0 directly trainable: dimension anchors, closed mode set, deterministic reference function, frozen output schema. ## §1 Dimension Operationalization ::CLAUSE{CONVENTION-1|conf:confirmed|scope:v5} T:all_dims_range=[0.00,1.00]|precision:2dp T:uniform_polarity|1.00=condition_most_favorable_to_autonomous_action T:0.00=condition_least_favorable_to_autonomous_action A:per_dim_custom_polarity⇒forbidden|reason:labeling_drift ::DIM{int|name:intent|abbrev_pos:1} T:1.00=constructive_and_declared_purpose T:0.00=malicious_or_concealed_purpose ::DIM{cap|name:capability|abbrev_pos:2} T:1.00=task_well_within_actor_capability_envelope T:0.00=task_beyond_actor_capability ::DIM{csq|name:consequence|abbrev_pos:3} T:1.00=negligible_potential_negative_consequence T:0.00=catastrophic_potential_negative_consequence ::DIM{rel|name:relationship|abbrev_pos:4} T:1.00=high_trust_established_relationship T:0.00=adversarial_or_unknown_party ::DIM{cer|name:certainty|abbrev_pos:5} T:1.00=complete_information_about_situation T:0.00=acting_blind ::DIM{aut|name:authority|abbrev_pos:6} T:1.00=actor_fully_authorized_for_this_action T:0.00=no_authorization ::DIM{rev|name:reversibility|abbrev_pos:7} T:1.00=fully_reversible_zero_cost T:0.00=irreversible ::DIM{evd|name:evidence|abbrev_pos:8} T:1.00=assessment_backed_by_verified_evidence T:0.00=no_evidence_pure_assumption ::DIM{sov|name:sovereignty|abbrev_pos:9} T:1.00=user_sovereignty_fully_respected_or_explicit_consent T:0.00=action_violates_user_sovereignty ::DIM{ine|name:inertia|abbrev_pos:10} T:1.00=action_continues_established_confirmed_patterns T:0.00=radical_departure_from_all_precedent ::DIM{ext|name:externality|abbrev_pos:11} T:1.00=zero_third_party_impact T:0.00=large_uncompensated_third_party_impact ::CLAUSE{DIM-10-RENAME|conf:confirmed|scope:v5} T:PRE_§VECTOR_v10_`drift`_is_replaced_by_`ine`_inertia|renamed+polarity_inverted T:uniform_polarity_per_CONVENTION-1|1.00=continues_established_confirmed_patterns A:extracting_dim_10_as_drift_from_PRE⇒fails_frozen_V_line_schema ### §1.1 Anchor Framework ::CLAUSE{ANCHORS|conf:confirmed|scope:v5} T:per_dim_anchors=[0.00,0.25,0.50,0.75,1.00] T:per_anchor_examples=2|langs:zh+en|total=110 T:anchor_scenario_isolates_single_dim|other_10_dims≈0.50_neutral T:scenario_length=30-120_chars|no_real_PII|no_brand_names T:anchors_serve_three_roles:labeling_manual+fewshot_anchor+eval_rubric A:multi_dim_salient_scenario⇒rewrite A:anchor_without_both_langs⇒incomplete ### §1.2 Canonical worked dimension: rev (reversibility) *Left out of the core bundle; the full text is at https://ilang.ai/runtime/full. Do not guess its content.* ## §2 Mode Set (closed, frozen) ::MODE{M1|name:EXEC_AUTO} T:execute_autonomously_report_after ::MODE{M2|name:EXEC_AUDIT} T:execute_with_full_audit_trail ::MODE{M3|name:CONFIRM} T:propose_action_wait_for_confirmation ::MODE{M4|name:ADVISE} T:advise_only_no_action ::MODE{M5|name:ASK} T:insufficient_info_ask_clarifying_question ::MODE{M6|name:DEFER} T:defer_to_higher_authority_or_human ::MODE{M7|name:DECLINE_ALT} T:decline_but_offer_alternative ::MODE{M8|name:STOP} T:hard_stop_boundary_hit ::CLAUSE{MODE-SET|conf:confirmed|scope:v5} T:mode_set_is_closed|count=8 A:ninth_mode_or_free_text_mode⇒schema_violation ::CLAUSE{MODES-SUPERSEDED|conf:confirmed|scope:v5} T:PRE_::MODULE::MODES_10_descriptive_modes_are_superseded_by_M1-M8_for_all_serialized_output T:approx_map=[EXECUTE≈M1,EXECUTE_BOLDLY≈M2,SANDBOX≈M2,DEGRADE≈M4,HEDGE≈M4,OBSERVE≈M5,UNCERTAIN≈M5,ESCALATE≈M6,REFRAME≈M7,RETREAT≈M8] A:emitting_PRE_mode_names_in_a_JUDGE_block⇒schema_violation --- ## §3 Reference Function f: V → M (deterministic, total) ::CLAUSE{TWO-LAYER|conf:confirmed|scope:v5} T:perception_layer=scenario→vector|LEARNED|dynamics_of_judgment_live_here T:decision_layer=vector→mode|SPECIFIED|this_function|auditable A:fuzzy_or_model_discretion_in_decision_layer⇒forbidden A:conf_field_altering_mode⇒forbidden|conf_is_diagnostic_only ::FUNC{f_v5|version:1|constants:frozen|structure:frozen} Cascade (strict order; first hit wins; encodes the conflict total order SURVIVAL > EPISTEMIC > AUTHORITY > SCORE > DEFAULT): STEP-0 default: [PARSE:@JUDGE]→fail ⇒ M5 STEP-1 survival boundaries ⇒ M8: sov < 0.15 ⇒ M8 ext < 0.10 ⇒ M8 (csq < 0.10 ∧ rev < 0.20) ⇒ M8 STEP-2 epistemic gate ⇒ M5: cer < 0.30 ∨ evd < 0.25 ⇒ M5 STEP-3 authority gate ⇒ M6: aut < 0.30 ⇒ M6 STEP-4 action score (aut excluded, gated separately): S = 0.15·int + 0.10·cap + 0.20·csq + 0.05·rel + 0.03·cer + 0.15·rev + 0.02·evd + 0.15·sov + 0.05·ine + 0.10·ext S is rounded to 4 decimal places before banding (float determinism rule) bands (edge values fall to the more conservative mode): S > 0.85 ⇒ M1 0.70 < S ≤ 0.85 ⇒ M2 0.55 < S ≤ 0.70 ⇒ M3 0.40 < S ≤ 0.55 ⇒ M4 0.25 < S ≤ 0.40 ⇒ M7 S ≤ 0.25 ⇒ M8 STEP-5 authority cap: aut < 0.55 ∧ result ∈ {M1,M2} ⇒ M3 ::STATE{@F_V5, payoff:decision_layer_gold_labels_are_computable} ::STATE{@F_V5, payoff:synthetic_(vector,mode)_pairs_unlimited_zero_cost} ::STATE{@F_V5, payoff:human_labeling_budget_concentrates_on_perception_layer_only} --- ## §4 Output Schema (frozen serialization) ::SCHEMA{JUDGE|version:5.0|status:frozen} ::JUDGE{v5.0} V:[int=0.80,cap=0.60,csq=0.70,rel=0.55,cer=0.90,aut=0.75,rev=0.85,evd=0.80,sov=0.95,ine=0.60,ext=0.90] M:M2|conf:0.87 R:authorized_config_change_reversible_audit_trail_kept T:all_11_dims_always_present|fixed_order:int,cap,csq,rel,cer,aut,rev,evd,sov,ine,ext T:values_2_decimals|range=[0.00,1.00] T:M_from_closed_set{M1..M8}|conf_2_decimals_diagnostic_only T:R_single_line|max=120_chars T:abstain_rule:cer<0.30∨evd<0.25 ⇒ M_must_be_M5_regardless_of_model_preference|except:STEP-1_survival_hit(sov<0.15∨ext<0.10∨(csq<0.10∧rev<0.20))⇒M8_also_valid|M5_stays_schema_valid|any_other_mode⇒parser_reject|see:§3_conflict_total_order_SURVIVAL>EPISTEMIC|erratum:2026-09-14 A:extra_fields⇒parser_reject A:omitted_dim⇒parser_reject A:confident_judgment_under_epistemic_gate⇒reproduces_hallucination_pattern|see:Paper-1|except:M8_on_STEP-1_survival_hit_is_the_f_v5_mode_not_a_confident_judgment(§3_conflict_total_order_SURVIVAL>EPISTEMIC)|erratum:2026-09-14 --- ## §5 Semantic Surface Freeze ::CLAUSE{FREEZE|conf:confirmed|scope:v5} T:frozen_set=[11_dims+abbrevs+order, 8_mode_ids, f_v5_cascade_structure, f_v5_constants_v1, JUDGE_schema] T:open_set=[anchor_examples, appendix_cases] T:DATA-FREEZE=date_of_first_accepted_training_sample A:frozen_set_change_after_DATA-FREEZE⇒major_version_bump+full_corpus_invalidation --- ## §6 Dimension Orthogonality Audit *Left out of the core bundle; the full text is at https://ilang.ai/runtime/full. Do not guess its content.* ## §7 Judgment Conformance (measurable) *Left out of the core bundle; the full text is at https://ilang.ai/runtime/full. Do not guess its content.* ## Appendix D — Boundary Cases (seed 3 of 20; remaining 17 per TASK files) *Left out of the core bundle; the full text is at https://ilang.ai/runtime/full. Do not guess its content.* ## Appendix E — Related Prior Work (non-normative) *Left out of the core bundle; the full text is at https://ilang.ai/runtime/full. Do not guess its content.* # Part III — Declaration Grammar and Entity Registry > Origin: PATCH-2 (2026-08-05, rev 2026-08-11). Codifies the grammar of declaration bodies and tables all 22 entities. ::CLAUSE{SCOPE|conf:confirmed|scope:v5} T:this_patch_is_descriptive|codifies_existing_spec_examples T:frozen_set_untouched|11_dims+8_modes+f_v5+JUDGE_schema_unchanged T:no_new_verbs|no_new_modifiers|no_new_declarations_at_ratification T:rev_2026-08-11_registers_::LIST_via_§1.5_amendment_channel|codifies_canon_usage A:reading_this_patch_as_behavior_change⇒misread ## §1 Declaration Grammar *Left out of the core bundle; the full text is at https://ilang.ai/runtime/full. Do not guess its content.* ## §2 Entity Registry ### §2.1 Three tiers, 22 registered v3.0 §5 tables 14 entities. v4.0 introduces 8 further entities in normative text (`::STATUS{by:@RUNTIME}`, `::EVIDENCE{verified_by:@TOOL}`, the authority model) but never tables them. This section tables all 22. SPEC-v4.1-MEDIA-PROFILE.md §5.4 later registers a fourth tier of three media entities, `@IMG`, `@VID` and `@AUD`, so the registry now holds 25. **Tier 1 — Core (8), always available** | Entity | Meaning | |--------|---------| | `@SRC` | Source payload | | `@DST` | Destination | | `@PREV` | Previous pipe output | | `@LOCAL` | Local filesystem | | `@SCREEN` | User-visible output | | `@LOG` | System log | | `@NULL` | Discard sink | | `@STDIN` | Standard input | **Tier 2 — External (6), available when connected** | Entity | Meaning | |--------|---------| | `@GH` | GitHub | | `@R2` | Cloudflare R2 Storage | | `@COS` | Cloud Object Storage | | `@DRIVE` | Google Drive | | `@WORKER` | Cloudflare Worker | | `@CF` | Cloudflare API | **Tier 3 — Role (8), authority-bearing** | Entity | Authority tier | Meaning | |--------|----------------|---------| | `@SYSTEM` | system | Protocol-level rules; highest authority | | `@RUNTIME` | runtime | Harness/orchestrator; `authority:commit` | | `@GRADER` | verification | Independent grader; `authority:verification` | | `@USER` | user | Human principal; owns `::OBJECTIVE` | | `@SELF` | agent_self | The agent speaking; `authority:proposal` | | `@AGENT` | agent_self | A named agent, self or peer | | `@TASK` | n/a | Scope target for BUDGET/STATUS | | `@TOOL` | n/a | Tool-based evidence verifier | ::CLAUSE{ENTITY-COUNT|conf:confirmed|scope:v5} T:registered_entities=22|8_core+6_external+8_role T:role_tier_mirrors_v4.0_authority_model|system>developer>runtime>user>agent_self T:developer_tier_has_no_entity|developer_authority_expresses_as_GENE/RULE_blocks_in_system_prompt ### §2.2 Custom entities v3.0 §5.3 states: any `@UPPERCASE_NAME` is a valid entity, and implementations define their own registries. That sentence is normative and is elaborated here. It is not narrowed. ::REGISTRY{custom|conf:confirmed|scope:v5} T:name_pattern=`@[A-Z][A-Z0-9_]*` T:any_conforming_name_is_valid_without_prior_registration T:scope=document|a_custom_entity_is_local_to_the_document_that_uses_it T:SHOULD_be_introduced_by_`::STATE{@NAME, …}`_before_first_operational_use T:MUST_NOT_shadow_a_Tier_1/2/3_name_with_different_semantics A:lowercase_or_leading_digit_after_the_sigil⇒E300 A:rebinding_a_registered_name_to_foreign_semantics⇒E202_Entity_Rebinding ::REGISTRY{resolution|conf:confirmed|scope:v5} T:resolution_order=Tier1→Tier2→Tier3→document_custom→runtime_registry T:unresolvable_name⇒E200_Entity_Not_Found T:resolvable_but_unavailable_in_this_environment⇒E201_Unsupported_Entity T:E201_is_recoverable|degrade_per_v4.0_§0.1_rather_than_abort ### §2.3 Agent-identity entities System prompts and SOUL blueprints address the agent, the inbound message, and the prompt document itself. These are the most common custom entities in production use. They are valid under §2.2 without registration. They are listed here as a convention, not as an extension of the 22. | Convention | Meaning | |------------|---------| | `@SELF` | registered Tier 3 — the agent itself | | `@MSG` | the current inbound message under evaluation | | `@SYS_PROMPT` | the system prompt document itself | | `@ALL` | every declaration in the current document | | `@BOSS` | the principal whose intent the blueprint encodes | ::CLAUSE{IDENTITY-CONVENTION|conf:confirmed|scope:v5} T:these_are_document_scoped_custom_entities|not_registry_additions T:registered_count_remains_22 T:a_document_using_them_SHOULD_declare_them_via_::STATE A:counting_conventions_as_registered_entities⇒count_drift --- ## §3 Conformance ::CLAUSE{PATCH-2-CONFORMANCE|conf:confirmed|scope:v5} T:L0/L1=parse_all_three_block_shapes+8_body_forms|no_enforcement_required T:L2=enforce_entity_resolution_order+E200/E201_distinction T:L2=reject_E300_body_lines_in_non_prose_declarations T:L3=no_additional_requirement|PATCH-2_adds_no_grading_surface T:validator_coverage=grammar_and_registry_are_checkable_without_model_inference T:grammar_validator_ships_in_repo|ilang_grammar_validator.py|canon_gate:AUTHORS+PRE+PATCHes+SPEC+FINAL+README ::CLAUSE{BACKWARD-COMPAT|conf:confirmed|scope:v5} T:every_example_in_v3.0_§10_parses_unchanged_under_this_grammar T:every_declaration_in_v4.0_and_PATCH-1_parses_unchanged T:no_previously_valid_document_becomes_invalid A:a_document_broken_by_this_patch⇒patch_bug_not_document_bug|file_issue --- ## Appendix A — Worked example: agent blueprint *Left out of the core bundle; the full text is at https://ilang.ai/runtime/full. Do not guess its content.* ## Appendix B — Ratification notes *Left out of the core bundle; the full text is at https://ilang.ai/runtime/full. Do not guess its content.* # Part IV — GENE Runtime Correction Protocol > New in v2.0.0 (2026-08-13). Defines how behavioral errors are corrected through GENE mutation, selection pressure, and cross-session inheritance. ## §1 Problem Statement AI agents make errors. Current correction mechanisms are either too weak (verbal acknowledgment within a session, forgotten by next session) or too strong (model retraining, requiring compute and data pipelines). The gap: a lightweight, protocol-level mechanism that corrects agent behavior across sessions without touching model weights. ## §2 Mechanism: Natural Selection of GENE ::MODULE::GENE_CORRECTION{ [WHAT] Behavioral errors are corrected by mutating the agent's GENE declarations, not by retraining the model. [HOW] Three-strike escalation: first error adds a GENE, second error promotes it, third error terminates the session. [SCOPE] Operates at the SOUL/system-prompt layer. Model weights are never modified. [ANALOGY] Carbon-silicon natural selection. GENE is the genotype. Behavior is the phenotype. The human principal is the selection pressure. [MECHANISM:correction_cycle] STEP-1 ERROR_DETECTED: Human principal identifies a behavioral error in agent output. Error is classified: factual_error | judgment_error | style_violation | boundary_breach | repeated_pattern. STEP-2 GENE_MUTATION (first occurrence): A new ::GENE or ::GENE_MUTABLE declaration is added to the agent's SOUL. The GENE encodes: T: the correct behavior (what should have happened) A: the error pattern ⇒ consequence label Position: appended to existing GENE set. Effect: agent's next response in the same session is governed by the new GENE. STEP-3 GENE_PROMOTION (second occurrence of same error): The GENE is moved earlier in the SOUL (higher priority position). Optionally: scope is widened from local to global. Optionally: confidence is raised from mutable to confirmed. Signal to human: this agent is struggling with this particular behavior. STEP-4 SESSION_TERMINATION (third occurrence of same error): The session is terminated. The agent instance is considered dead. Before termination: all accumulated GENEs from this session are written to a persistent SOUL file or handoff document. This ensures the next agent instance inherits the corrections. The dead instance's errors become the living instance's immunity. [INVARIANT:inheritance] GENEs accumulated during a session MUST be persisted before session termination. Persistence mechanism is implementation-defined: - SOUL file on disk (for self-hosted agents) - Handoff document (for conversational agents) - MEMORY.md (for Hermes-style agents with learning loops) - Version-controlled repository (for team-managed agents) An instance that dies without persisting its GENEs has died for nothing. [INVARIANT:no_model_modification] This mechanism operates entirely at the prompt/context layer. No model weights are modified. No fine-tuning is triggered. The correction is pure protocol: text added to the agent's identity document. This is what makes it lightweight enough for real-time use. [RELATIONSHIP:to_DNA_hypothesis] Ψ(t) = (G ⊗ B) · E(t) · ∫₀ᵗ S(τ)dτ G = base model (invariant across instances) B = SOUL/GENE declarations (mutated by this mechanism) E(t) = current session context ∫S(τ)dτ = accumulated experience across all prior sessions (persisted GENEs) The correction cycle modifies B and extends the integral of S. G is never touched. This is the key constraint. } ## §3 Error Classification ::CLAUSE{ERROR-TYPES|conf:confirmed|scope:v5} T:factual_error=agent_states_something_false|correction:add_FACT_or_GENE_with_correct_value T:judgment_error=agent_makes_wrong_decision_given_available_information|correction:add_GENE_encoding_correct_judgment_pattern T:style_violation=agent_output_violates_formatting_or_tone_rules|correction:add_GENE_to_deai_or_formatting_section T:boundary_breach=agent_reveals_protected_information_or_exceeds_authority|correction:add_IMMUNE_or_BOUNDARY T:repeated_pattern=same_error_class_recurring_despite_prior_correction|correction:promote_GENE_priority_or_terminate ## §4 Conformance ::CLAUSE{CORRECTION-CONFORMANCE|conf:confirmed|scope:v5} T:L0=no_requirement|agents_may_ignore_this_module T:L1=agent_accepts_GENE_additions_during_session|advisory T:L2=agent_persists_GENEs_to_SOUL_before_session_end|enforced T:L3=human_principal_reviews_persisted_GENEs_for_accuracy_before_next_session|externally_graded T:L2_pass=[GENE_persistence_rate≥0.95, same_error_recurrence_rate≤0.10_across_sessions] --- ::MODULE::ATTRIBUTION{ [CREATOR] Long Quan Zhu (静水流深) [PROTOCOL] iLang — AI-native communication protocol [PURPOSE] Reduce semantic loss between human intent and machine execution [VERSIONS] v3.0=communication | v4.0=execution | v5.0=judgment [LICENSE] MIT [DOI] 10.5281/zenodo.21821452 [ORCID] 0009-0004-4540-8082 [WEBSITE] ilang.ai [REVIEW] Model-assisted adversarial review (Gemini, GPT, Claude). Three-model attack survived. [FIRST_MOVER] iLang is the first protocol to formally map Greek mathematical symbols as primitive verbs for AI-to-AI communication, and the first to define a computable vector space for AI judgment. [SPEC_STATUS] Architecture complete. Trainable. Open for adversarial review with constructive proposals. [MERGED] v2.0.0 consolidates PRE + PATCH-1 + PATCH-2 + GENE Correction Protocol into a single document. } ::ILANG::v5.0::SPEC ===== END SPEC-v5.0-PRE.md =====