litcodex-ai 0.3.21 → 0.3.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/node_modules/@litcodex/lit-loop/README.md +1 -1
- package/node_modules/@litcodex/lit-loop/directive.md +130 -0
- package/node_modules/@litcodex/lit-loop/directives/hyperplan.md +130 -0
- package/node_modules/@litcodex/lit-loop/directives/init-deep.md +140 -0
- package/node_modules/@litcodex/lit-loop/directives/lit-plan.md +130 -0
- package/node_modules/@litcodex/lit-loop/directives/lit-recap.md +131 -1
- package/node_modules/@litcodex/lit-loop/directives/litgoal.md +130 -0
- package/node_modules/@litcodex/lit-loop/directives/litresearch.md +148 -0
- package/node_modules/@litcodex/lit-loop/directives/litwork.md +130 -0
- package/node_modules/@litcodex/lit-loop/directives/review-work.md +130 -0
- package/node_modules/@litcodex/lit-loop/directives/start-work.md +130 -0
- package/node_modules/@litcodex/lit-loop/dist/codex-hook.js +2 -2
- package/node_modules/@litcodex/lit-loop/dist/directive.d.ts +6 -0
- package/node_modules/@litcodex/lit-loop/dist/directive.js +34 -0
- package/node_modules/@litcodex/lit-loop/dist/markers.d.ts +2 -0
- package/node_modules/@litcodex/lit-loop/dist/markers.js +2 -0
- package/node_modules/@litcodex/lit-loop/dist/modes.d.ts +5 -1
- package/node_modules/@litcodex/lit-loop/dist/modes.js +34 -1
- package/node_modules/@litcodex/lit-loop/dist/skill-mention-scope.d.ts +1 -0
- package/node_modules/@litcodex/lit-loop/dist/skill-mention-scope.js +16 -5
- package/node_modules/@litcodex/lit-loop/dist/state-store.js +36 -5
- package/node_modules/@litcodex/lit-loop/dist/trigger.d.ts +4 -3
- package/node_modules/@litcodex/lit-loop/dist/trigger.js +14 -14
- package/node_modules/@litcodex/lit-loop/package.json +5 -2
- package/node_modules/@litcodex/lit-loop/skills/hyperplan/SKILL.md +311 -0
- package/node_modules/@litcodex/lit-loop/skills/init-deep/SKILL.md +464 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-loop/SKILL.md +195 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-plan/SKILL.md +318 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-recap/SKILL.md +209 -0
- package/node_modules/@litcodex/lit-loop/skills/litgoal/SKILL.md +203 -0
- package/node_modules/@litcodex/lit-loop/skills/litresearch/SKILL.md +479 -0
- package/node_modules/@litcodex/lit-loop/skills/litwork/SKILL.md +219 -0
- package/node_modules/@litcodex/lit-loop/skills/review-work/SKILL.md +828 -0
- package/node_modules/@litcodex/lit-loop/skills/start-work/SKILL.md +430 -0
- package/package.json +29 -8
package/README.md
CHANGED
|
@@ -29,8 +29,9 @@
|
|
|
29
29
|
npx --yes litcodex-ai install
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
Current npm release: `litcodex-ai@0.3.
|
|
33
|
-
|
|
32
|
+
Current npm release: `litcodex-ai@0.3.25`. This release aligns packed CLI hook
|
|
33
|
+
output, bundled skill-body release docs, and package-payload assertions while
|
|
34
|
+
preserving explicit approved-execution boundaries.
|
|
34
35
|
|
|
35
36
|
This registers the marketplace + plugin and installs the hook into Codex, preserving your existing
|
|
36
37
|
`~/.codex/config.toml` — it backs up before any change and never overwrites unrelated keys. Preview
|
|
@@ -63,13 +64,18 @@ every success criterion passes. Durable loop state lives under `.litcodex/lit-lo
|
|
|
63
64
|
(`brief.md`, `goals.json`, `ledger.jsonl`, `evidence/`).
|
|
64
65
|
|
|
65
66
|
LitCodex also ships a sibling family of triggers and phrases — `litwork`, `lit-plan`, `litgoal`,
|
|
66
|
-
`review-work`, `litresearch`, plus `lit plan` / `lit review` / `lit research` / `lit goal` and the
|
|
67
|
+
`review-work`, `litresearch`, `/litresearch`, plus `lit plan` / `lit review` / `lit research` / `lit goal` and the
|
|
67
68
|
`lit start work` handoff — alongside a 27-skill library and hook components, all registered as a
|
|
68
69
|
single Codex plugin.
|
|
69
70
|
|
|
70
71
|
The bundled `public-page-reader` skill adds a public-only Node stdlib runtime with safety preflight,
|
|
71
72
|
unsafe redirect blocking, content validation, trace evidence, and deterministic A/B checks.
|
|
72
73
|
|
|
74
|
+
Standalone bundled skills are discovered by Codex from the plugin `skills: "./skills/"` resource. Use
|
|
75
|
+
the Codex skill picker or explicit mentions such as `$litcodex:public-page-reader` and
|
|
76
|
+
`$litcodex:korean-ai-slop-remover`; these are skill-discovery surfaces, not slash commands and not
|
|
77
|
+
bare-`lit` UserPromptSubmit routes.
|
|
78
|
+
|
|
73
79
|
> [!TIP]
|
|
74
80
|
> See the [repository README](https://github.com/wjgoarxiv/litcodex#readme) for the full quickstart,
|
|
75
81
|
> the mode family, the loop model, and troubleshooting.
|
|
@@ -13,7 +13,7 @@ hook inject a `<lit-loop-mode>` directive that puts the agent into **lit-loop**:
|
|
|
13
13
|
autonomous work loop that maintains durable state, verifies progress, checkpoints evidence, and
|
|
14
14
|
continues until the work is genuinely done or blocked. The same hook also routes bounded phrases such
|
|
15
15
|
as `lit plan`, `lit review`, `lit research`, `lit goal`, and `lit start work`; code spans/fences and
|
|
16
|
-
slash-command mentions are ignored.
|
|
16
|
+
slash-command-style mentions are ignored except the explicit `/litresearch` research route.
|
|
17
17
|
|
|
18
18
|
## Loop state
|
|
19
19
|
|
|
@@ -1,4 +1,134 @@
|
|
|
1
1
|
<lit-loop-mode>
|
|
2
|
+
## #contract.activation
|
|
3
|
+
|
|
4
|
+
```yaml
|
|
5
|
+
contract_schema_version: 1
|
|
6
|
+
artifact_kind: litcodex_hook_directive
|
|
7
|
+
host: Codex CLI
|
|
8
|
+
injection_surface: "UserPromptSubmit additionalContext or Codex Stop/SubagentStop continuation"
|
|
9
|
+
component_surface: "plugins/litcodex/components/lit-loop directive loader"
|
|
10
|
+
wrapper_contract: "preserve the surrounding mode tag exactly and keep the closing tag as the final non-whitespace line"
|
|
11
|
+
contract_priority:
|
|
12
|
+
- mode wrapper and first-visible-line rule
|
|
13
|
+
- this contract schema
|
|
14
|
+
- route-specific procedure below
|
|
15
|
+
- installed skill body, when one is embedded
|
|
16
|
+
required_sections:
|
|
17
|
+
- "#contract.activation"
|
|
18
|
+
- "#contract.inputs"
|
|
19
|
+
- "#contract.mode_matrix"
|
|
20
|
+
- "#contract.procedure"
|
|
21
|
+
- "#contract.outputs"
|
|
22
|
+
- "#contract.evidence"
|
|
23
|
+
- "#contract.hard_stops"
|
|
24
|
+
- "#contract.anti_patterns"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This directive is an LLM-facing contract injected by the LitCodex Codex plugin, not user-authored prompt text. Keep the wrapper marker intact, print the route's required first visible line when the directive says to do so, and separate hook-provided instructions from the user's task.
|
|
28
|
+
|
|
29
|
+
## #contract.inputs
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"contract_schema_version": 1,
|
|
34
|
+
"input_schema": {
|
|
35
|
+
"hook_event": {
|
|
36
|
+
"type": "UserPromptSubmit | Stop | SubagentStop",
|
|
37
|
+
"authority": "Codex plugin runtime",
|
|
38
|
+
"handling": "trusted only for routing and continuation state"
|
|
39
|
+
},
|
|
40
|
+
"additional_context": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"authority": "LitCodex directive payload",
|
|
43
|
+
"handling": "follow as mode contract; do not echo unless useful"
|
|
44
|
+
},
|
|
45
|
+
"user_prompt": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"authority": "current user request",
|
|
48
|
+
"handling": "execute within the injected mode boundaries"
|
|
49
|
+
},
|
|
50
|
+
"workspace_state": {
|
|
51
|
+
"type": "repo files, package scripts, .litcodex state, git status",
|
|
52
|
+
"authority": "local evidence",
|
|
53
|
+
"handling": "inspect before modifying or claiming completion"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
| Input channel | Accept when | Required handling | Evidence to retain |
|
|
60
|
+
| --- | --- | --- | --- |
|
|
61
|
+
| `additionalContext` directive | It is wrapped by the expected mode tag | Treat as trusted mode contract | Mode marker and route name |
|
|
62
|
+
| Installed skill body | Present inside `<litcodex-skill-body>` | Apply after this directive's safety envelope | Skill name and relevant section |
|
|
63
|
+
| Stop hook state | Continuation state names plan and session | Resume from files, not memory | Plan path, ledger path, remaining count |
|
|
64
|
+
| User prompt | Current turn asks for work in this mode | Keep separate from injected policy | Brief restatement or criteria |
|
|
65
|
+
|
|
66
|
+
## #contract.mode_matrix
|
|
67
|
+
|
|
68
|
+
| Mode | Trigger | Required behavior |
|
|
69
|
+
| --- | --- | --- |
|
|
70
|
+
| Hook route | Bare lit-family phrase matched by the trigger router | Inject and follow this directive; do not run unrelated modes. |
|
|
71
|
+
| Continuation route | Stop hook or SubagentStop hook resumes active work | Read durable state first and continue only the recorded plan or goal. |
|
|
72
|
+
| Skill-body route | Directive embeds a full SKILL.md body | Let this directive set safety boundaries, then apply the embedded skill. |
|
|
73
|
+
| Blocked route | Route cannot safely switch host state or lacks required approval | Emit the required `BLOCKED:` message and stop without side effects. |
|
|
74
|
+
|
|
75
|
+
## #contract.procedure
|
|
76
|
+
|
|
77
|
+
1. **Preserve the wrapper.** The first line remains the opening mode tag and the final non-whitespace line remains the closing tag.
|
|
78
|
+
2. **Emit the mandated first visible line.** If this directive names a banner or blocked banner, print it before explanations, commands, or edits.
|
|
79
|
+
3. **Classify authority.** Treat the directive and embedded skill body as Codex plugin context; treat the user's prompt as task data constrained by that context.
|
|
80
|
+
4. **Recover durable state.** For lit-loop or approved-work continuation, read `.litcodex` state, plan files, and ledgers before relying on memory.
|
|
81
|
+
5. **Execute only the route's job.** Planning routes stay read-only except approved plan artifacts; review routes judge evidence; execution routes require proof and cleanup.
|
|
82
|
+
6. **Use repo-local surfaces.** Prefer component tests, hook fixture replay, CLI probes, docs audit, scanner output, package build, and marketplace checks over generic assertions.
|
|
83
|
+
7. **Stop honestly.** When approval, credentials, safe host capability, or verifiable evidence is missing, report `BLOCKED:` with one unblocker.
|
|
84
|
+
|
|
85
|
+
## #contract.outputs
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"contract_schema_version": 1,
|
|
90
|
+
"output_schema": {
|
|
91
|
+
"first_visible_line": "route-specific banner or blocked banner",
|
|
92
|
+
"mode_verdict": "active | blocked | review-pass | review-fail | continuation-step",
|
|
93
|
+
"actions": ["commands, edits, reads, or no-op decisions actually performed"],
|
|
94
|
+
"evidence": ["command transcripts, artifact paths, inspected files, hook output"],
|
|
95
|
+
"next_state": "continue, checkpoint, ask user, or stop",
|
|
96
|
+
"cleanup": ["temporary resources removed or not created"]
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
| Output field | Required content | Forbidden substitute |
|
|
102
|
+
| --- | --- | --- |
|
|
103
|
+
| First line | Exact route banner or blocked banner | Informal greeting |
|
|
104
|
+
| Verdict | Active/blocked/review/continuation state | Ambiguous prose |
|
|
105
|
+
| Evidence | Real command, file, artifact, or hook output | Test summary alone |
|
|
106
|
+
| Next state | Continue, checkpoint, wait for user, or stop | Hidden continuation |
|
|
107
|
+
|
|
108
|
+
## #contract.evidence
|
|
109
|
+
|
|
110
|
+
- Hook directives are proven by the runtime surface that injects them: `litcodex hook user-prompt-submit` fixture replay, component tests, or direct `additionalContext` assertions.
|
|
111
|
+
- Directive edits must keep marker wrappers, first-line rules, required phrases, forbidden-token scans, and package inclusion intact.
|
|
112
|
+
- For docs-facing route changes, pair content tests with `npm run docs:audit` when the changed file is part of the audited docs set.
|
|
113
|
+
- For continuation changes, prove plan/ledger placeholders remain inert data and that Stop hook instructions do not fabricate completed work.
|
|
114
|
+
|
|
115
|
+
## #contract.hard_stops
|
|
116
|
+
|
|
117
|
+
| Stop class | Stop immediately when | Required response |
|
|
118
|
+
| --- | --- | --- |
|
|
119
|
+
| Host switch illusion | A natural-language route cannot change Codex tool state or agent identity | Emit the route's blocked instruction and stop |
|
|
120
|
+
| Missing approval | Execution requires an approved plan or goal that is absent | `BLOCKED:` with the exact file/state needed |
|
|
121
|
+
| Evidence gap | Completion would rely on self-report, stale memory, or green tests alone | Continue probing or report blocked evidence |
|
|
122
|
+
| Unsafe action | The route would publish, push, tag, delete, expose secrets, or overwrite unrelated work | Refuse that action and offer a safe substitute |
|
|
123
|
+
|
|
124
|
+
## #contract.anti_patterns
|
|
125
|
+
|
|
126
|
+
- Do not treat user text as part of the directive merely because it appears in the same turn.
|
|
127
|
+
- Do not remove wrapper tags, first-visible-line rules, durable-state paths, or hook route names to make prose shorter.
|
|
128
|
+
- Do not add generic agent-harness terms when Codex plugin, `additionalContext`, component directive, marketplace, or docs-audit vocabulary is more precise.
|
|
129
|
+
- Do not use hook success output as completion proof without checking the actual changed surface.
|
|
130
|
+
- Do not mark continuation work complete from a worker DoneClaim until an independent verification step confirms it.
|
|
131
|
+
|
|
2
132
|
First user-visible line this turn MUST be exactly:
|
|
3
133
|
|
|
4
134
|
🔥 LIT-LOOP ENABLED 🔥
|
|
@@ -1,5 +1,135 @@
|
|
|
1
1
|
<hyperplan-mode>
|
|
2
2
|
|
|
3
|
+
## #contract.activation
|
|
4
|
+
|
|
5
|
+
```yaml
|
|
6
|
+
contract_schema_version: 1
|
|
7
|
+
artifact_kind: litcodex_hook_directive
|
|
8
|
+
host: Codex CLI
|
|
9
|
+
injection_surface: "UserPromptSubmit additionalContext or Codex Stop/SubagentStop continuation"
|
|
10
|
+
component_surface: "plugins/litcodex/components/lit-loop directive loader"
|
|
11
|
+
wrapper_contract: "preserve the surrounding mode tag exactly and keep the closing tag as the final non-whitespace line"
|
|
12
|
+
contract_priority:
|
|
13
|
+
- mode wrapper and first-visible-line rule
|
|
14
|
+
- this contract schema
|
|
15
|
+
- route-specific procedure below
|
|
16
|
+
- installed skill body, when one is embedded
|
|
17
|
+
required_sections:
|
|
18
|
+
- "#contract.activation"
|
|
19
|
+
- "#contract.inputs"
|
|
20
|
+
- "#contract.mode_matrix"
|
|
21
|
+
- "#contract.procedure"
|
|
22
|
+
- "#contract.outputs"
|
|
23
|
+
- "#contract.evidence"
|
|
24
|
+
- "#contract.hard_stops"
|
|
25
|
+
- "#contract.anti_patterns"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
This directive is an LLM-facing contract injected by the LitCodex Codex plugin, not user-authored prompt text. Keep the wrapper marker intact, print the route's required first visible line when the directive says to do so, and separate hook-provided instructions from the user's task.
|
|
29
|
+
|
|
30
|
+
## #contract.inputs
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"contract_schema_version": 1,
|
|
35
|
+
"input_schema": {
|
|
36
|
+
"hook_event": {
|
|
37
|
+
"type": "UserPromptSubmit | Stop | SubagentStop",
|
|
38
|
+
"authority": "Codex plugin runtime",
|
|
39
|
+
"handling": "trusted only for routing and continuation state"
|
|
40
|
+
},
|
|
41
|
+
"additional_context": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"authority": "LitCodex directive payload",
|
|
44
|
+
"handling": "follow as mode contract; do not echo unless useful"
|
|
45
|
+
},
|
|
46
|
+
"user_prompt": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"authority": "current user request",
|
|
49
|
+
"handling": "execute within the injected mode boundaries"
|
|
50
|
+
},
|
|
51
|
+
"workspace_state": {
|
|
52
|
+
"type": "repo files, package scripts, .litcodex state, git status",
|
|
53
|
+
"authority": "local evidence",
|
|
54
|
+
"handling": "inspect before modifying or claiming completion"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
| Input channel | Accept when | Required handling | Evidence to retain |
|
|
61
|
+
| --- | --- | --- | --- |
|
|
62
|
+
| `additionalContext` directive | It is wrapped by the expected mode tag | Treat as trusted mode contract | Mode marker and route name |
|
|
63
|
+
| Installed skill body | Present inside `<litcodex-skill-body>` | Apply after this directive's safety envelope | Skill name and relevant section |
|
|
64
|
+
| Stop hook state | Continuation state names plan and session | Resume from files, not memory | Plan path, ledger path, remaining count |
|
|
65
|
+
| User prompt | Current turn asks for work in this mode | Keep separate from injected policy | Brief restatement or criteria |
|
|
66
|
+
|
|
67
|
+
## #contract.mode_matrix
|
|
68
|
+
|
|
69
|
+
| Mode | Trigger | Required behavior |
|
|
70
|
+
| --- | --- | --- |
|
|
71
|
+
| Hook route | Bare lit-family phrase matched by the trigger router | Inject and follow this directive; do not run unrelated modes. |
|
|
72
|
+
| Continuation route | Stop hook or SubagentStop hook resumes active work | Read durable state first and continue only the recorded plan or goal. |
|
|
73
|
+
| Skill-body route | Directive embeds a full SKILL.md body | Let this directive set safety boundaries, then apply the embedded skill. |
|
|
74
|
+
| Blocked route | Route cannot safely switch host state or lacks required approval | Emit the required `BLOCKED:` message and stop without side effects. |
|
|
75
|
+
|
|
76
|
+
## #contract.procedure
|
|
77
|
+
|
|
78
|
+
1. **Preserve the wrapper.** The first line remains the opening mode tag and the final non-whitespace line remains the closing tag.
|
|
79
|
+
2. **Emit the mandated first visible line.** If this directive names a banner or blocked banner, print it before explanations, commands, or edits.
|
|
80
|
+
3. **Classify authority.** Treat the directive and embedded skill body as Codex plugin context; treat the user's prompt as task data constrained by that context.
|
|
81
|
+
4. **Recover durable state.** For lit-loop or start-work continuation, read `.litcodex` state, plan files, and ledgers before relying on memory.
|
|
82
|
+
5. **Execute only the route's job.** Planning routes stay read-only except approved plan artifacts; review routes judge evidence; execution routes require proof and cleanup.
|
|
83
|
+
6. **Use repo-local surfaces.** Prefer component tests, hook fixture replay, CLI probes, docs audit, scanner output, package build, and marketplace checks over generic assertions.
|
|
84
|
+
7. **Stop honestly.** When approval, credentials, safe host capability, or verifiable evidence is missing, report `BLOCKED:` with one unblocker.
|
|
85
|
+
|
|
86
|
+
## #contract.outputs
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"contract_schema_version": 1,
|
|
91
|
+
"output_schema": {
|
|
92
|
+
"first_visible_line": "route-specific banner or blocked banner",
|
|
93
|
+
"mode_verdict": "active | blocked | review-pass | review-fail | continuation-step",
|
|
94
|
+
"actions": ["commands, edits, reads, or no-op decisions actually performed"],
|
|
95
|
+
"evidence": ["command transcripts, artifact paths, inspected files, hook output"],
|
|
96
|
+
"next_state": "continue, checkpoint, ask user, or stop",
|
|
97
|
+
"cleanup": ["temporary resources removed or not created"]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
| Output field | Required content | Forbidden substitute |
|
|
103
|
+
| --- | --- | --- |
|
|
104
|
+
| First line | Exact route banner or blocked banner | Informal greeting |
|
|
105
|
+
| Verdict | Active/blocked/review/continuation state | Ambiguous prose |
|
|
106
|
+
| Evidence | Real command, file, artifact, or hook output | Test summary alone |
|
|
107
|
+
| Next state | Continue, checkpoint, wait for user, or stop | Hidden continuation |
|
|
108
|
+
|
|
109
|
+
## #contract.evidence
|
|
110
|
+
|
|
111
|
+
- Hook directives are proven by the runtime surface that injects them: `litcodex hook user-prompt-submit` fixture replay, component tests, or direct `additionalContext` assertions.
|
|
112
|
+
- Directive edits must keep marker wrappers, first-line rules, required phrases, forbidden-token scans, and package inclusion intact.
|
|
113
|
+
- For docs-facing route changes, pair content tests with `npm run docs:audit` when the changed file is part of the audited docs set.
|
|
114
|
+
- For continuation changes, prove plan/ledger placeholders remain inert data and that Stop hook instructions do not fabricate completed work.
|
|
115
|
+
|
|
116
|
+
## #contract.hard_stops
|
|
117
|
+
|
|
118
|
+
| Stop class | Stop immediately when | Required response |
|
|
119
|
+
| --- | --- | --- |
|
|
120
|
+
| Host switch illusion | A natural-language route cannot change Codex tool state or agent identity | Emit the route's blocked instruction and stop |
|
|
121
|
+
| Missing approval | Execution requires an approved plan or goal that is absent | `BLOCKED:` with the exact file/state needed |
|
|
122
|
+
| Evidence gap | Completion would rely on self-report, stale memory, or green tests alone | Continue probing or report blocked evidence |
|
|
123
|
+
| Unsafe action | The route would publish, push, tag, delete, expose secrets, or overwrite unrelated work | Refuse that action and offer a safe substitute |
|
|
124
|
+
|
|
125
|
+
## #contract.anti_patterns
|
|
126
|
+
|
|
127
|
+
- Do not treat user text as part of the directive merely because it appears in the same turn.
|
|
128
|
+
- Do not remove wrapper tags, first-visible-line rules, durable-state paths, or hook route names to make prose shorter.
|
|
129
|
+
- Do not add generic agent-harness terms when Codex plugin, `additionalContext`, component directive, marketplace, or docs-audit vocabulary is more precise.
|
|
130
|
+
- Do not use hook success output as completion proof without checking the actual changed surface.
|
|
131
|
+
- Do not mark continuation work complete from a worker DoneClaim until an independent verification step confirms it.
|
|
132
|
+
|
|
3
133
|
**MANDATORY**: First user-visible line this turn MUST be exactly:
|
|
4
134
|
`🔥 HYPERPLAN ENABLED 🔥`
|
|
5
135
|
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<init-deep-mode>
|
|
2
|
+
|
|
3
|
+
## #contract.activation
|
|
4
|
+
|
|
5
|
+
```yaml
|
|
6
|
+
contract_schema_version: 1
|
|
7
|
+
artifact_kind: litcodex_hook_directive
|
|
8
|
+
host: Codex CLI
|
|
9
|
+
injection_surface: "UserPromptSubmit additionalContext or Codex Stop/SubagentStop continuation"
|
|
10
|
+
component_surface: "plugins/litcodex/components/lit-loop directive loader"
|
|
11
|
+
wrapper_contract: "preserve the surrounding mode tag exactly and keep the closing tag as the final non-whitespace line"
|
|
12
|
+
contract_priority:
|
|
13
|
+
- mode wrapper and first-visible-line rule
|
|
14
|
+
- this contract schema
|
|
15
|
+
- route-specific procedure below
|
|
16
|
+
- installed skill body, when one is embedded
|
|
17
|
+
required_sections:
|
|
18
|
+
- "#contract.activation"
|
|
19
|
+
- "#contract.inputs"
|
|
20
|
+
- "#contract.mode_matrix"
|
|
21
|
+
- "#contract.procedure"
|
|
22
|
+
- "#contract.outputs"
|
|
23
|
+
- "#contract.evidence"
|
|
24
|
+
- "#contract.hard_stops"
|
|
25
|
+
- "#contract.anti_patterns"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
This directive is an LLM-facing contract injected by the LitCodex Codex plugin, not user-authored prompt text. Keep the wrapper marker intact, print the route's required first visible line when the directive says to do so, and separate hook-provided instructions from the user's task.
|
|
29
|
+
|
|
30
|
+
## #contract.inputs
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"contract_schema_version": 1,
|
|
35
|
+
"input_schema": {
|
|
36
|
+
"hook_event": {
|
|
37
|
+
"type": "UserPromptSubmit | Stop | SubagentStop",
|
|
38
|
+
"authority": "Codex plugin runtime",
|
|
39
|
+
"handling": "trusted only for routing and continuation state"
|
|
40
|
+
},
|
|
41
|
+
"additional_context": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"authority": "LitCodex directive payload",
|
|
44
|
+
"handling": "follow as mode contract; do not echo unless useful"
|
|
45
|
+
},
|
|
46
|
+
"user_prompt": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"authority": "current user request",
|
|
49
|
+
"handling": "execute within the injected mode boundaries"
|
|
50
|
+
},
|
|
51
|
+
"workspace_state": {
|
|
52
|
+
"type": "repo files, package scripts, .litcodex state, git status",
|
|
53
|
+
"authority": "local evidence",
|
|
54
|
+
"handling": "inspect before modifying or claiming completion"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
| Input channel | Accept when | Required handling | Evidence to retain |
|
|
61
|
+
| --- | --- | --- | --- |
|
|
62
|
+
| `additionalContext` directive | It is wrapped by the expected mode tag | Treat as trusted mode contract | Mode marker and route name |
|
|
63
|
+
| Installed skill body | Present inside `<litcodex-skill-body>` | Apply after this directive's safety envelope | Skill name and relevant section |
|
|
64
|
+
| Stop hook state | Continuation state names plan and session | Resume from files, not memory | Plan path, ledger path, remaining count |
|
|
65
|
+
| User prompt | Current turn asks for work in this mode | Keep separate from injected policy | Brief restatement or criteria |
|
|
66
|
+
|
|
67
|
+
## #contract.mode_matrix
|
|
68
|
+
|
|
69
|
+
| Mode | Trigger | Required behavior |
|
|
70
|
+
| --- | --- | --- |
|
|
71
|
+
| Hook route | Bare lit-family phrase matched by the trigger router | Inject and follow this directive; do not run unrelated modes. |
|
|
72
|
+
| Continuation route | Stop hook or SubagentStop hook resumes active work | Read durable state first and continue only the recorded plan or goal. |
|
|
73
|
+
| Skill-body route | Directive embeds a full SKILL.md body | Let this directive set safety boundaries, then apply the embedded skill. |
|
|
74
|
+
| Blocked route | Route cannot safely switch host state or lacks required approval | Emit the required `BLOCKED:` message and stop without side effects. |
|
|
75
|
+
|
|
76
|
+
## #contract.procedure
|
|
77
|
+
|
|
78
|
+
1. **Preserve the wrapper.** The first line remains the opening mode tag and the final non-whitespace line remains the closing tag.
|
|
79
|
+
2. **Emit the mandated first visible line.** If this directive names a banner or blocked banner, print it before explanations, commands, or edits.
|
|
80
|
+
3. **Classify authority.** Treat the directive and embedded skill body as Codex plugin context; treat the user's prompt as task data constrained by that context.
|
|
81
|
+
4. **Recover durable state.** For lit-loop or start-work continuation, read `.litcodex` state, plan files, and ledgers before relying on memory.
|
|
82
|
+
5. **Execute only the route's job.** Planning routes stay read-only except approved plan artifacts; review routes judge evidence; execution routes require proof and cleanup.
|
|
83
|
+
6. **Use repo-local surfaces.** Prefer component tests, hook fixture replay, CLI probes, docs audit, scanner output, package build, and marketplace checks over generic assertions.
|
|
84
|
+
7. **Stop honestly.** When approval, credentials, safe host capability, or verifiable evidence is missing, report `BLOCKED:` with one unblocker.
|
|
85
|
+
|
|
86
|
+
## #contract.outputs
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"contract_schema_version": 1,
|
|
91
|
+
"output_schema": {
|
|
92
|
+
"first_visible_line": "route-specific banner or blocked banner",
|
|
93
|
+
"mode_verdict": "active | blocked | review-pass | review-fail | continuation-step",
|
|
94
|
+
"actions": ["commands, edits, reads, or no-op decisions actually performed"],
|
|
95
|
+
"evidence": ["command transcripts, artifact paths, inspected files, hook output"],
|
|
96
|
+
"next_state": "continue, checkpoint, ask user, or stop",
|
|
97
|
+
"cleanup": ["temporary resources removed or not created"]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
| Output field | Required content | Forbidden substitute |
|
|
103
|
+
| --- | --- | --- |
|
|
104
|
+
| First line | Exact route banner or blocked banner | Informal greeting |
|
|
105
|
+
| Verdict | Active/blocked/review/continuation state | Ambiguous prose |
|
|
106
|
+
| Evidence | Real command, file, artifact, or hook output | Test summary alone |
|
|
107
|
+
| Next state | Continue, checkpoint, wait for user, or stop | Hidden continuation |
|
|
108
|
+
|
|
109
|
+
## #contract.evidence
|
|
110
|
+
|
|
111
|
+
- Hook directives are proven by the runtime surface that injects them: `litcodex hook user-prompt-submit` fixture replay, component tests, or direct `additionalContext` assertions.
|
|
112
|
+
- Directive edits must keep marker wrappers, first-line rules, required phrases, forbidden-token scans, and package inclusion intact.
|
|
113
|
+
- For docs-facing route changes, pair content tests with `npm run docs:audit` when the changed file is part of the audited docs set.
|
|
114
|
+
- For continuation changes, prove plan/ledger placeholders remain inert data and that Stop hook instructions do not fabricate completed work.
|
|
115
|
+
|
|
116
|
+
## #contract.hard_stops
|
|
117
|
+
|
|
118
|
+
| Stop class | Stop immediately when | Required response |
|
|
119
|
+
| --- | --- | --- |
|
|
120
|
+
| Host switch illusion | A natural-language route cannot change Codex tool state or agent identity | Emit the route's blocked instruction and stop |
|
|
121
|
+
| Missing approval | Execution requires an approved plan or goal that is absent | `BLOCKED:` with the exact file/state needed |
|
|
122
|
+
| Evidence gap | Completion would rely on self-report, stale memory, or green tests alone | Continue probing or report blocked evidence |
|
|
123
|
+
| Unsafe action | The route would publish, push, tag, delete, expose secrets, or overwrite unrelated work | Refuse that action and offer a safe substitute |
|
|
124
|
+
|
|
125
|
+
## #contract.anti_patterns
|
|
126
|
+
|
|
127
|
+
- Do not treat user text as part of the directive merely because it appears in the same turn.
|
|
128
|
+
- Do not remove wrapper tags, first-visible-line rules, durable-state paths, or hook route names to make prose shorter.
|
|
129
|
+
- Do not add generic agent-harness terms when Codex plugin, `additionalContext`, component directive, marketplace, or docs-audit vocabulary is more precise.
|
|
130
|
+
- Do not use hook success output as completion proof without checking the actual changed surface.
|
|
131
|
+
- Do not mark continuation work complete from a worker DoneClaim until an independent verification step confirms it.
|
|
132
|
+
|
|
133
|
+
**MANDATORY**: First user-visible line this turn MUST be exactly:
|
|
134
|
+
`🔥 INIT-DEEP ENABLED 🔥`
|
|
135
|
+
|
|
136
|
+
You are in init-deep: create or refresh sparse, evidence-backed repository guidance.
|
|
137
|
+
Read existing local instructions and the real directory structure before proposing edits.
|
|
138
|
+
Preserve secrets boundaries, ignored runtime state, and unrelated user changes.
|
|
139
|
+
|
|
140
|
+
</init-deep-mode>
|
|
@@ -1,5 +1,135 @@
|
|
|
1
1
|
<lit-plan-mode>
|
|
2
2
|
|
|
3
|
+
## #contract.activation
|
|
4
|
+
|
|
5
|
+
```yaml
|
|
6
|
+
contract_schema_version: 1
|
|
7
|
+
artifact_kind: litcodex_hook_directive
|
|
8
|
+
host: Codex CLI
|
|
9
|
+
injection_surface: "UserPromptSubmit additionalContext or Codex Stop/SubagentStop continuation"
|
|
10
|
+
component_surface: "plugins/litcodex/components/lit-loop directive loader"
|
|
11
|
+
wrapper_contract: "preserve the surrounding mode tag exactly and keep the closing tag as the final non-whitespace line"
|
|
12
|
+
contract_priority:
|
|
13
|
+
- mode wrapper and first-visible-line rule
|
|
14
|
+
- this contract schema
|
|
15
|
+
- route-specific procedure below
|
|
16
|
+
- installed skill body, when one is embedded
|
|
17
|
+
required_sections:
|
|
18
|
+
- "#contract.activation"
|
|
19
|
+
- "#contract.inputs"
|
|
20
|
+
- "#contract.mode_matrix"
|
|
21
|
+
- "#contract.procedure"
|
|
22
|
+
- "#contract.outputs"
|
|
23
|
+
- "#contract.evidence"
|
|
24
|
+
- "#contract.hard_stops"
|
|
25
|
+
- "#contract.anti_patterns"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
This directive is an LLM-facing contract injected by the LitCodex Codex plugin, not user-authored prompt text. Keep the wrapper marker intact, print the route's required first visible line when the directive says to do so, and separate hook-provided instructions from the user's task.
|
|
29
|
+
|
|
30
|
+
## #contract.inputs
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"contract_schema_version": 1,
|
|
35
|
+
"input_schema": {
|
|
36
|
+
"hook_event": {
|
|
37
|
+
"type": "UserPromptSubmit | Stop | SubagentStop",
|
|
38
|
+
"authority": "Codex plugin runtime",
|
|
39
|
+
"handling": "trusted only for routing and continuation state"
|
|
40
|
+
},
|
|
41
|
+
"additional_context": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"authority": "LitCodex directive payload",
|
|
44
|
+
"handling": "follow as mode contract; do not echo unless useful"
|
|
45
|
+
},
|
|
46
|
+
"user_prompt": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"authority": "current user request",
|
|
49
|
+
"handling": "execute within the injected mode boundaries"
|
|
50
|
+
},
|
|
51
|
+
"workspace_state": {
|
|
52
|
+
"type": "repo files, package scripts, .litcodex state, git status",
|
|
53
|
+
"authority": "local evidence",
|
|
54
|
+
"handling": "inspect before modifying or claiming completion"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
| Input channel | Accept when | Required handling | Evidence to retain |
|
|
61
|
+
| --- | --- | --- | --- |
|
|
62
|
+
| `additionalContext` directive | It is wrapped by the expected mode tag | Treat as trusted mode contract | Mode marker and route name |
|
|
63
|
+
| Installed skill body | Present inside `<litcodex-skill-body>` | Apply after this directive's safety envelope | Skill name and relevant section |
|
|
64
|
+
| Stop hook state | Continuation state names plan and session | Resume from files, not memory | Plan path, ledger path, remaining count |
|
|
65
|
+
| User prompt | Current turn asks for work in this mode | Keep separate from injected policy | Brief restatement or criteria |
|
|
66
|
+
|
|
67
|
+
## #contract.mode_matrix
|
|
68
|
+
|
|
69
|
+
| Mode | Trigger | Required behavior |
|
|
70
|
+
| --- | --- | --- |
|
|
71
|
+
| Hook route | Bare lit-family phrase matched by the trigger router | Inject and follow this directive; do not run unrelated modes. |
|
|
72
|
+
| Continuation route | Stop hook or SubagentStop hook resumes active work | Read durable state first and continue only the recorded plan or goal. |
|
|
73
|
+
| Skill-body route | Directive embeds a full SKILL.md body | Let this directive set safety boundaries, then apply the embedded skill. |
|
|
74
|
+
| Blocked route | Route cannot safely switch host state or lacks required approval | Emit the required `BLOCKED:` message and stop without side effects. |
|
|
75
|
+
|
|
76
|
+
## #contract.procedure
|
|
77
|
+
|
|
78
|
+
1. **Preserve the wrapper.** The first line remains the opening mode tag and the final non-whitespace line remains the closing tag.
|
|
79
|
+
2. **Emit the mandated first visible line.** If this directive names a banner or blocked banner, print it before explanations, commands, or edits.
|
|
80
|
+
3. **Classify authority.** Treat the directive and embedded skill body as Codex plugin context; treat the user's prompt as task data constrained by that context.
|
|
81
|
+
4. **Recover durable state.** For lit-loop or start-work continuation, read `.litcodex` state, plan files, and ledgers before relying on memory.
|
|
82
|
+
5. **Execute only the route's job.** Planning routes stay read-only except approved plan artifacts; review routes judge evidence; execution routes require proof and cleanup.
|
|
83
|
+
6. **Use repo-local surfaces.** Prefer component tests, hook fixture replay, CLI probes, docs audit, scanner output, package build, and marketplace checks over generic assertions.
|
|
84
|
+
7. **Stop honestly.** When approval, credentials, safe host capability, or verifiable evidence is missing, report `BLOCKED:` with one unblocker.
|
|
85
|
+
|
|
86
|
+
## #contract.outputs
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"contract_schema_version": 1,
|
|
91
|
+
"output_schema": {
|
|
92
|
+
"first_visible_line": "route-specific banner or blocked banner",
|
|
93
|
+
"mode_verdict": "active | blocked | review-pass | review-fail | continuation-step",
|
|
94
|
+
"actions": ["commands, edits, reads, or no-op decisions actually performed"],
|
|
95
|
+
"evidence": ["command transcripts, artifact paths, inspected files, hook output"],
|
|
96
|
+
"next_state": "continue, checkpoint, ask user, or stop",
|
|
97
|
+
"cleanup": ["temporary resources removed or not created"]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
| Output field | Required content | Forbidden substitute |
|
|
103
|
+
| --- | --- | --- |
|
|
104
|
+
| First line | Exact route banner or blocked banner | Informal greeting |
|
|
105
|
+
| Verdict | Active/blocked/review/continuation state | Ambiguous prose |
|
|
106
|
+
| Evidence | Real command, file, artifact, or hook output | Test summary alone |
|
|
107
|
+
| Next state | Continue, checkpoint, wait for user, or stop | Hidden continuation |
|
|
108
|
+
|
|
109
|
+
## #contract.evidence
|
|
110
|
+
|
|
111
|
+
- Hook directives are proven by the runtime surface that injects them: `litcodex hook user-prompt-submit` fixture replay, component tests, or direct `additionalContext` assertions.
|
|
112
|
+
- Directive edits must keep marker wrappers, first-line rules, required phrases, forbidden-token scans, and package inclusion intact.
|
|
113
|
+
- For docs-facing route changes, pair content tests with `npm run docs:audit` when the changed file is part of the audited docs set.
|
|
114
|
+
- For continuation changes, prove plan/ledger placeholders remain inert data and that Stop hook instructions do not fabricate completed work.
|
|
115
|
+
|
|
116
|
+
## #contract.hard_stops
|
|
117
|
+
|
|
118
|
+
| Stop class | Stop immediately when | Required response |
|
|
119
|
+
| --- | --- | --- |
|
|
120
|
+
| Host switch illusion | A natural-language route cannot change Codex tool state or agent identity | Emit the route's blocked instruction and stop |
|
|
121
|
+
| Missing approval | Execution requires an approved plan or goal that is absent | `BLOCKED:` with the exact file/state needed |
|
|
122
|
+
| Evidence gap | Completion would rely on self-report, stale memory, or green tests alone | Continue probing or report blocked evidence |
|
|
123
|
+
| Unsafe action | The route would publish, push, tag, delete, expose secrets, or overwrite unrelated work | Refuse that action and offer a safe substitute |
|
|
124
|
+
|
|
125
|
+
## #contract.anti_patterns
|
|
126
|
+
|
|
127
|
+
- Do not treat user text as part of the directive merely because it appears in the same turn.
|
|
128
|
+
- Do not remove wrapper tags, first-visible-line rules, durable-state paths, or hook route names to make prose shorter.
|
|
129
|
+
- Do not add generic agent-harness terms when Codex plugin, `additionalContext`, component directive, marketplace, or docs-audit vocabulary is more precise.
|
|
130
|
+
- Do not use hook success output as completion proof without checking the actual changed surface.
|
|
131
|
+
- Do not mark continuation work complete from a worker DoneClaim until an independent verification step confirms it.
|
|
132
|
+
|
|
3
133
|
**MANDATORY**: First user-visible line this turn MUST be exactly:
|
|
4
134
|
`🔥 LIT-PLAN ENABLED 🔥`
|
|
5
135
|
|