@minhpnq1807/contextos 0.5.12 → 0.5.14

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.14
4
+
5
+ - Adds an actual rendered terminal demo GIF generated from `ctx debug` plus a real `codex exec` hook run.
6
+ - Points the README demo section at `docs/demo/contextos-demo.gif`.
7
+
8
+ ## 0.5.13
9
+
10
+ - Reworks the README for launch: demo-first positioning, fear hook, one-line install, before/after, and quick command table.
11
+ - Adds a launch kit and concrete demo recording script for HN/X/GitHub/npm launch prep.
12
+ - Adds `ctx-codex` as a bin alias for npm package execution flows.
13
+
3
14
  ## 0.5.12
4
15
 
5
16
  - Makes `ctx sync --workflows` synchronize unique workflow files to global Claude, Codex, and Antigravity workflow roots.
package/DEMO.md CHANGED
@@ -1,24 +1,54 @@
1
1
  # ContextOS Demo Script
2
2
 
3
- Use this script to record the README demo GIF or terminal clip.
3
+ Use this to record the README GIF or a short terminal clip.
4
+
5
+ The current rendered demo is checked in at:
6
+
7
+ ```text
8
+ docs/demo/contextos-demo.gif
9
+ ```
10
+
11
+ It was generated from an actual terminal transcript using:
12
+
13
+ ```text
14
+ node docs/demo/render-terminal-gif.mjs <terminal-log> docs/demo/contextos-demo.gif
15
+ ```
16
+
17
+ ## Goal
18
+
19
+ Show one thing clearly:
20
+
21
+ ```text
22
+ AGENTS.md rule buried in a long file -> ContextOS injects the relevant rule -> ctx report proves whether it was followed
23
+ ```
4
24
 
5
25
  ## Setup
6
26
 
7
27
  ```bash
8
28
  npm install -g @minhpnq1807/contextos
9
- ctx install
29
+ ctx setup --yes --agents codex
10
30
  ```
11
31
 
12
- Restart Codex after install.
32
+ Restart Codex after setup.
33
+
34
+ ## Fixture Rule
35
+
36
+ Use a repo whose `AGENTS.md` contains a rule like:
37
+
38
+ ```text
39
+ IMPORTANT: This project has a knowledge graph. Always use code-review-graph MCP tools before Grep/Glob/Read.
40
+ ```
41
+
42
+ The rule should be somewhere below the first screen of `AGENTS.md` so the demo makes the lost-in-the-middle problem obvious.
13
43
 
14
44
  ## Recording Flow
15
45
 
16
- 1. Open a project with an `AGENTS.md`.
17
- 2. Start Codex.
46
+ 1. Show the rule in `AGENTS.md`.
47
+ 2. Start Codex in the project.
18
48
  3. Submit:
19
49
 
20
50
  ```text
21
- kiểm tra flow kiểm duyệt upload
51
+ Recheck authen flow
22
52
  ```
23
53
 
24
54
  4. Show the `hook context` block:
@@ -28,30 +58,45 @@ kiểm tra flow kiểm duyệt upload
28
58
  ...
29
59
  ## Suggested files to check
30
60
  ...
61
+ ## Suggested workflow for this task
62
+ ...
31
63
  ```
32
64
 
33
- 5. Let the task finish so the Stop hook runs.
65
+ 5. Let the task finish so the Stop hook writes the report.
34
66
  6. Show:
35
67
 
36
68
  ```bash
69
+ ctx report
37
70
  ctx evidence
38
71
  ctx stats
39
72
  ```
40
73
 
41
- ## Expected Talking Points
74
+ ## Side-By-Side Clip
75
+
76
+ Record two short terminal panes:
77
+
78
+ | Left | Right |
79
+ | --- | --- |
80
+ | Codex without ContextOS. | Codex with ContextOS. |
81
+ | Agent starts by reading random files or grepping. | Hook context shows the relevant rule before work starts. |
82
+ | No evidence report. | `ctx report` shows followed/ignored/unknown. |
83
+
84
+ ## Talking Points
42
85
 
43
- - ContextOS does not replace Codex or wrap the CLI.
44
- - It runs as a Codex plugin with hooks plus `ctx-mcp`.
86
+ - ContextOS does not replace Codex, Claude Code, or Antigravity.
87
+ - It runs through native hooks plus a local `ctx-mcp` MCP server.
45
88
  - It uses local embeddings to bridge vocabulary mismatch such as `kiểm duyệt` and `moderation`.
46
- - It reports `followed`, `ignored`, and `unknown` outcomes after the task.
89
+ - Runtime history is isolated by project path and shared across supported agents.
90
+ - It reports what happened after the task instead of only hoping the agent remembered rules.
47
91
 
48
- ## Current Release Checks
92
+ ## Release Checks
49
93
 
50
- Run before recording:
94
+ Run before recording or posting:
51
95
 
52
96
  ```bash
53
97
  npm run validate:plugin
54
98
  npm test
55
99
  npm run test:mcp
56
100
  npm pack --dry-run
101
+ npm view @minhpnq1807/contextos version
57
102
  ```
package/LAUNCH.md ADDED
@@ -0,0 +1,93 @@
1
+ # ContextOS Launch Kit
2
+
3
+ ## Positioning
4
+
5
+ ContextOS fixes the practical problem where agents technically receive `AGENTS.md`, but task-critical rules are lost in the middle of a large context window.
6
+
7
+ One-line pitch:
8
+
9
+ ```text
10
+ ContextOS makes Codex, Claude Code, and Antigravity follow the right AGENTS.md rules by injecting task-relevant context before each task and reporting what was followed afterward.
11
+ ```
12
+
13
+ ## Hacker News
14
+
15
+ Title:
16
+
17
+ ```text
18
+ ContextOS - Codex ignores your AGENTS.md. This fixes it.
19
+ ```
20
+
21
+ Post:
22
+
23
+ ```text
24
+ I built ContextOS because I kept seeing agents miss important rules in AGENTS.md once the file got long.
25
+
26
+ The problem is not that agents cannot read the file. The problem is attention: the relevant rule is often buried in the middle of context.
27
+
28
+ ContextOS runs as native hooks plus a local MCP server. On each prompt it:
29
+
30
+ - scores AGENTS.md rules against the task
31
+ - injects the relevant rules at the start/end of the prompt context
32
+ - suggests likely files, skills, and workflows
33
+ - records runtime telemetry
34
+ - reports followed / ignored / unknown after the task
35
+
36
+ It supports Codex, Claude Code, and Antigravity. It is local-first and uses local MiniLM embeddings.
37
+
38
+ Install:
39
+
40
+ npm install -g @minhpnq1807/contextos && ctx setup
41
+
42
+ Repo: https://github.com/khovan123/contextOS
43
+ ```
44
+
45
+ ## X / Twitter
46
+
47
+ Short:
48
+
49
+ ```text
50
+ Codex can read AGENTS.md and still ignore the rule that matters.
51
+
52
+ ContextOS ranks rules per prompt, injects the important ones before work starts, then reports followed / ignored / unknown after the task.
53
+
54
+ npm install -g @minhpnq1807/contextos && ctx setup
55
+
56
+ https://github.com/khovan123/contextOS
57
+ ```
58
+
59
+ With GIF:
60
+
61
+ ```text
62
+ AGENTS.md is not enough when the important rule is buried in the middle.
63
+
64
+ ContextOS:
65
+ 1. scores rules against the prompt
66
+ 2. injects the relevant context
67
+ 3. suggests files/workflows
68
+ 4. reports what the agent followed
69
+
70
+ Demo below.
71
+ ```
72
+
73
+ ## GitHub Repo Description
74
+
75
+ ```text
76
+ Task-aware AGENTS.md context injection and compliance reports for Codex, Claude Code, and Antigravity.
77
+ ```
78
+
79
+ ## npm Description
80
+
81
+ ```text
82
+ Task-aware AGENTS.md context injection and compliance reporting for Codex, Claude Code, and Antigravity.
83
+ ```
84
+
85
+ ## Launch Checklist
86
+
87
+ - [ ] README starts with problem, demo, install, before/after.
88
+ - [ ] Demo GIF or terminal clip recorded.
89
+ - [ ] `npm view @minhpnq1807/contextos version` matches latest tag.
90
+ - [ ] Fresh install tested in a separate project.
91
+ - [ ] GitHub repo description updated.
92
+ - [ ] HN post prepared.
93
+ - [ ] X post prepared with GIF.
package/README.md CHANGED
@@ -1,111 +1,155 @@
1
1
  # ContextOS
2
2
 
3
- ContextOS (`ctx`) is an agent companion for task-aware project context.
3
+ Codex ignores the middle of your `AGENTS.md`. ContextOS fixes that.
4
4
 
5
- It reads `AGENTS.md` guidance, scores the rules against the current prompt, suggests relevant files, records what context would have been injected, and reports lightweight compliance evidence after the task finishes.
5
+ It ranks your project rules against the current prompt, injects the right ones at the moment the agent starts work, suggests relevant files/skills/workflows, and reports what the agent actually followed after the task.
6
+
7
+ ```text
8
+ WITHOUT ContextOS
9
+ AGENTS.md is a long static blob
10
+ important rules drift into the middle
11
+ agent starts by grepping files and misses the repo contract
12
+
13
+ WITH ContextOS
14
+ prompt -> score relevant AGENTS.md rules
15
+ -> inject critical rules at top and bottom
16
+ -> suggest files, skills, workflows
17
+ -> report followed / ignored / unknown
18
+ ```
6
19
 
7
20
  Published package: [`@minhpnq1807/contextos`](https://www.npmjs.com/package/@minhpnq1807/contextos)
8
21
 
9
- ## Quick Start
22
+ ## Demo
23
+
24
+ ![ContextOS actual terminal demo](docs/demo/contextos-demo.gif)
25
+
26
+ Example hook context injected before the agent works:
27
+
28
+ ```text
29
+ ## Critical ContextOS rules
30
+ - IMPORTANT: This project has a knowledge graph. ALWAYS use code-review-graph MCP tools before Grep/Glob/Read.
31
+ - Use `query_graph` pattern="tests_for" to check coverage.
32
+
33
+ ## Suggested files to check
34
+ - services/content-service/test/unit/creator-only.policy.unit-spec.ts
35
+ - services/content-service/test/integration/resource-upload.integration-spec.ts
36
+
37
+ ## Suggested workflow for this task
38
+ - Primary Workflow: use for feature implementation, testing, review, and debugging
39
+ chain: planner -> tester -> code-reviewer
40
+ ```
41
+
42
+ After the task:
43
+
44
+ ```text
45
+ ContextOS report
46
+ Efficiency: 100%
47
+ Injected rules: 8
48
+ Rule outcomes: 8 followed, 0 ignored, 0 unknown
49
+ Runtime telemetry: code-review-graph, code-review-graph.query_graph_tool
50
+ ```
51
+
52
+ ## Install In One Line
10
53
 
11
54
  ```bash
12
- npm install -g @minhpnq1807/contextos
13
- ctx --version
14
- ctx setup
55
+ npm install -g @minhpnq1807/contextos && ctx setup
15
56
  ```
16
57
 
17
- `ctx setup` is the recommended first-run flow. It asks which agents to configure, whether prompt context injection should be enabled, whether to sync project rules/MCP through Ruler, and whether to sync skills through skillshare. It only runs when you explicitly invoke it; npm install does not run setup automatically.
58
+ No postinstall surprise: `npm install` only installs the CLI. Setup runs only when you call `ctx setup`.
18
59
 
19
- For scriptable installs, use:
60
+ Scriptable setup:
20
61
 
21
62
  ```bash
22
63
  ctx setup --yes
23
64
  ctx setup --yes --agents codex,claude,agy
24
65
  ```
25
66
 
26
- Restart your agent after setup, then use it normally. ContextOS runs through agent hooks and the `ctx-mcp` MCP server.
67
+ No global install:
68
+
69
+ ```bash
70
+ npm exec --yes --package=@minhpnq1807/contextos@latest -- ctx setup
71
+ npm exec --yes --package=@minhpnq1807/contextos@latest -- ctx-codex install
72
+ ```
27
73
 
28
- Codex-only install is still available:
74
+ Codex-only:
29
75
 
30
76
  ```bash
31
77
  ctx install
32
78
  ```
33
79
 
34
- Claude Code and Antigravity are supported through their native hook systems:
80
+ Claude Code and Antigravity:
35
81
 
36
82
  ```bash
37
83
  ctx install claude
38
84
  ctx install agy
39
85
  ```
40
86
 
41
- You can also run without a global install:
87
+ Restart the agent after setup. Then use the agent normally.
42
88
 
43
- ```bash
44
- npx @minhpnq1807/contextos@latest install
45
- npx @minhpnq1807/contextos@latest setup
46
- npx @minhpnq1807/contextos@latest install claude
47
- npx @minhpnq1807/contextos@latest install agy
48
- ```
89
+ ## Why
90
+
91
+ Developers put real operating instructions in `AGENTS.md`: use this graph tool before reading files, run these tests, follow this architecture boundary, avoid this migration path.
92
+
93
+ The problem is not that agents cannot read `AGENTS.md`. The problem is that large context windows bury the important rule in the middle, where attention is weak. ContextOS turns a static rules file into task-aware runtime context.
94
+
95
+ ## What ContextOS Does
96
+
97
+ | Layer | What happens |
98
+ | --- | --- |
99
+ | Hooks | Codex, Claude Code, and Antigravity hooks run before/after each task. |
100
+ | Scoring | Local MiniLM embeddings plus heuristics rank AGENTS.md rules by the prompt. |
101
+ | Injection | Critical rules are placed with primacy + recency, not buried in the middle. |
102
+ | Discovery | Relevant files, skills, and workflows are suggested before work starts. |
103
+ | Sync | Rules/MCP via Ruler, skills via skillshare, workflows via ContextOS. |
104
+ | Evidence | Stop hooks report `followed`, `ignored`, `unknown`, and runtime telemetry. |
105
+
106
+ ## Quick Commands
107
+
108
+ | Command | Use it for |
109
+ | --- | --- |
110
+ | `ctx setup` | Recommended first-run install flow. |
111
+ | `ctx debug -- "Recheck authen flow"` | Preview what ContextOS would inject. |
112
+ | `ctx report` | Show the last task's compliance summary. |
113
+ | `ctx evidence` | Show why each rule was marked followed/ignored/unknown. |
114
+ | `ctx stats` | Show workspace-level usage and effectiveness metrics. |
115
+ | `ctx benchmark -- "task"` | Compare raw AGENTS.md ordering vs ContextOS scheduling. |
116
+ | `ctx sync --rules` | Sync AGENTS/Ruler/MCP config across agents. |
117
+ | `ctx sync --skills` | Sync skills across agents through skillshare. |
118
+ | `ctx sync --workflows` | Sync workflow markdown across Claude/Codex/Antigravity. |
119
+
120
+ ## 60-Second Demo Script
121
+
122
+ 1. Start in a repo with an `AGENTS.md` that contains a rule like:
49
123
 
50
- ## Demo Flow
124
+ ```text
125
+ Always use code-review-graph MCP tools before reading files.
126
+ ```
51
127
 
52
- Use this flow for a 60-second demo recording:
128
+ 2. Install:
53
129
 
54
130
  ```bash
55
- ctx install
56
- codex
131
+ npm install -g @minhpnq1807/contextos
132
+ ctx setup --yes --agents codex
57
133
  ```
58
134
 
59
- Prompt the agent:
135
+ 3. Restart Codex and submit:
60
136
 
61
137
  ```text
62
138
  Recheck authen flow
63
139
  ```
64
140
 
65
- Expected result:
66
-
67
- - `UserPromptSubmit` injects relevant AGENTS.md rules.
68
- - ContextOS suggests auth/authentication files.
69
- - `Stop` prints a ContextOS report with rule outcomes.
70
- - `ctx evidence` shows the specific evidence behind the last report.
71
-
72
- ## Before / After
141
+ 4. Show the injected `hook context`.
73
142
 
74
- Without ContextOS, Codex receives the full AGENTS.md context passively and can miss task-relevant rules in large context windows.
143
+ 5. Let the task finish, then run:
75
144
 
76
- With ContextOS, each prompt gets a compact block:
145
+ ```bash
146
+ ctx report
147
+ ctx evidence
148
+ ```
77
149
 
78
- ```text
79
- ## Critical ContextOS rules
80
- - Use code-review-graph before reading files.
81
- - Recheck authentication flow before editing auth code.
150
+ The demo should show one idea: ContextOS puts the right rule in front of the agent before work starts, then proves whether the rule was followed.
82
151
 
83
- ## Suggested files to check
84
- - services/auth-service/src/auth.controller.ts
85
- - services/auth-service/src/auth.service.ts
86
- ```
87
-
88
- ## What It Does
89
-
90
- - Hooks into Codex `UserPromptSubmit`, `SessionStart`, and `Stop`.
91
- - Hooks into Claude Code `UserPromptSubmit`, `SessionStart`, and `Stop`.
92
- - Hooks into Antigravity `PreInvocation` and `Stop` through the `agy` adapter.
93
- - Registers a `ctx-mcp` MCP server that owns model loading and semantic scoring.
94
- - Reads the active `AGENTS.md` chain for the current workspace.
95
- - Scores rules by relevance to the user prompt.
96
- - Scans project/global `.codex/skills`, `.claude/skills`, and Antigravity `.gemini/**/skills`, ranks skill descriptions by task relevance, and injects top skill hints.
97
- - Filters host/session setup rules such as "run commands as user X" or `sudo -u user` because they are environment instructions, not project guidance.
98
- - Finds likely relevant files with a hybrid retriever:
99
- - first, local prompt/file heuristics create seed candidates;
100
- - then, if `.code-review-graph/graph.db` exists, ContextOS queries `code-review-graph` semantic search and re-ranks graph-backed matches;
101
- - if no graph exists or graph lookup times out, it falls back to local heuristics.
102
- - Stores scheduled context and hook telemetry per workspace under `~/.ctx/contextos/workspaces/<workspace-id>`.
103
- - Reports rule outcomes as `followed`, `ignored`, or `unknown`, using runtime telemetry for tool/command rules when available.
104
- - Injects `additionalContext` into Codex by default.
105
-
106
- By default, ContextOS runs in injection mode. It adds task-relevant rules and files to the model context so the agent has the right project guidance at the moment it starts working.
107
-
108
- ## Install
152
+ ## Detailed Install
109
153
 
110
154
  From the package:
111
155
 
@@ -0,0 +1,25 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1280" height="720" viewBox="0 0 1280 720" role="img" aria-labelledby="title desc">
2
+ <title id="title">ContextOS demo placeholder</title>
3
+ <desc id="desc">A terminal-style before and after preview for ContextOS.</desc>
4
+ <rect width="1280" height="720" fill="#101418"/>
5
+ <rect x="64" y="54" width="1152" height="612" rx="14" fill="#161c22" stroke="#303944"/>
6
+ <text x="96" y="105" fill="#f4f1e8" font-family="Inter, Arial, sans-serif" font-size="38" font-weight="700">ContextOS</text>
7
+ <text x="96" y="142" fill="#a7b0ba" font-family="Inter, Arial, sans-serif" font-size="20">Codex ignores the middle of AGENTS.md. ContextOS moves the right rules into the prompt.</text>
8
+
9
+ <rect x="96" y="190" width="520" height="356" rx="10" fill="#1d252d" stroke="#3a4552"/>
10
+ <text x="126" y="232" fill="#ffcf70" font-family="Inter, Arial, sans-serif" font-size="24" font-weight="700">Before</text>
11
+ <text x="126" y="278" fill="#cbd5df" font-family="SFMono-Regular, Consolas, monospace" font-size="18">AGENTS.md loaded as a long blob</text>
12
+ <text x="126" y="316" fill="#7f8b97" font-family="SFMono-Regular, Consolas, monospace" font-size="18">... rule buried in the middle ...</text>
13
+ <text x="126" y="354" fill="#e97979" font-family="SFMono-Regular, Consolas, monospace" font-size="18">agent starts with grep/read</text>
14
+ <text x="126" y="392" fill="#e97979" font-family="SFMono-Regular, Consolas, monospace" font-size="18">repo contract missed</text>
15
+
16
+ <rect x="664" y="190" width="520" height="356" rx="10" fill="#1d252d" stroke="#3a4552"/>
17
+ <text x="694" y="232" fill="#8ed8a3" font-family="Inter, Arial, sans-serif" font-size="24" font-weight="700">After</text>
18
+ <text x="694" y="278" fill="#cbd5df" font-family="SFMono-Regular, Consolas, monospace" font-size="18">prompt -&gt; score rules</text>
19
+ <text x="694" y="316" fill="#cbd5df" font-family="SFMono-Regular, Consolas, monospace" font-size="18">inject critical context</text>
20
+ <text x="694" y="354" fill="#8ed8a3" font-family="SFMono-Regular, Consolas, monospace" font-size="18">suggest files + workflow</text>
21
+ <text x="694" y="392" fill="#8ed8a3" font-family="SFMono-Regular, Consolas, monospace" font-size="18">report followed / ignored / unknown</text>
22
+
23
+ <rect x="96" y="588" width="1088" height="44" rx="8" fill="#0f151a" stroke="#303944"/>
24
+ <text x="120" y="616" fill="#f4f1e8" font-family="SFMono-Regular, Consolas, monospace" font-size="18">npm install -g @minhpnq1807/contextos &amp;&amp; ctx setup</text>
25
+ </svg>
Binary file
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env node
2
+ import fs from "node:fs";
3
+ import os from "node:os";
4
+ import path from "node:path";
5
+ import { execFileSync } from "node:child_process";
6
+
7
+ const [, , inputPath, outputPath = "docs/demo/contextos-demo.gif"] = process.argv;
8
+ if (!inputPath) {
9
+ console.error("Usage: node docs/demo/render-terminal-gif.mjs <terminal-log> [output.gif]");
10
+ process.exit(1);
11
+ }
12
+
13
+ const width = 960;
14
+ const height = 540;
15
+ const marginX = 52;
16
+ const marginY = 54;
17
+ const lineHeight = 18;
18
+ const maxLines = 22;
19
+ const maxColumns = 100;
20
+ const frameStep = 5;
21
+
22
+ const raw = fs.readFileSync(inputPath, "utf8");
23
+ const lines = clean(raw)
24
+ .split(/\r?\n/)
25
+ .map((line) => line.trimEnd())
26
+ .filter((line) => line && !line.includes("Script started") && !line.includes("Script done"));
27
+
28
+ const displayLines = wrapLines(lines, maxColumns).slice(0, 110);
29
+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "contextos-demo-frames-"));
30
+ const frames = [];
31
+
32
+ for (let count = 1; count <= displayLines.length; count += frameStep) {
33
+ frames.push(writeFrame({ tmpDir, index: frames.length, lines: displayLines.slice(0, count) }));
34
+ }
35
+ frames.push(writeFrame({ tmpDir, index: frames.length, lines: displayLines }));
36
+
37
+ fs.mkdirSync(path.dirname(outputPath), { recursive: true });
38
+ execFileSync("convert", ["-delay", "12", "-loop", "0", ...frames, outputPath], { stdio: "inherit" });
39
+ console.log(`Wrote ${outputPath}`);
40
+
41
+ function writeFrame({ tmpDir, index, lines }) {
42
+ const visible = lines.slice(-maxLines);
43
+ const svg = [
44
+ `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}">`,
45
+ `<rect width="${width}" height="${height}" fill="#0f1419"/>`,
46
+ `<rect x="24" y="24" width="${width - 48}" height="${height - 48}" rx="16" fill="#151b22" stroke="#34404d"/>`,
47
+ `<circle cx="56" cy="50" r="6" fill="#ff6b6b"/><circle cx="78" cy="50" r="6" fill="#ffd166"/><circle cx="100" cy="50" r="6" fill="#70d88b"/>`,
48
+ `<text x="124" y="57" fill="#9aa6b2" font-family="DejaVu Sans Mono, Consolas, monospace" font-size="15">ContextOS actual terminal demo</text>`,
49
+ `<text x="${marginX}" y="${marginY + 30}" fill="#d8dee9" font-family="DejaVu Sans Mono, Consolas, monospace" font-size="15">`
50
+ ];
51
+ visible.forEach((line, offset) => {
52
+ const y = offset === 0 ? 0 : lineHeight;
53
+ svg.push(`<tspan x="${marginX}" dy="${y}" fill="${colorForLine(line)}">${escapeXml(line)}</tspan>`);
54
+ });
55
+ svg.push("</text></svg>");
56
+ const filePath = path.join(tmpDir, `frame-${String(index).padStart(4, "0")}.svg`);
57
+ fs.writeFileSync(filePath, svg.join(""));
58
+ return filePath;
59
+ }
60
+
61
+ function clean(value) {
62
+ return String(value)
63
+ .replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, "")
64
+ .replace(/\r/g, "\n")
65
+ .replace(/\n+/g, "\n");
66
+ }
67
+
68
+ function wrapLines(sourceLines, widthLimit) {
69
+ const wrapped = [];
70
+ for (const line of sourceLines) {
71
+ if (line.length <= widthLimit) {
72
+ wrapped.push(line);
73
+ continue;
74
+ }
75
+ for (let index = 0; index < line.length; index += widthLimit) {
76
+ wrapped.push(`${index === 0 ? "" : " "}${line.slice(index, index + widthLimit)}`);
77
+ }
78
+ }
79
+ return wrapped;
80
+ }
81
+
82
+ function colorForLine(line) {
83
+ if (line.startsWith("$ ")) return "#8bd5ff";
84
+ if (/^(ContextOS debug|ContextOS report|Final additionalContext|Suggested files|Suggested workflows)/.test(line)) return "#ffd166";
85
+ if (/^(hook:|mcp:)/.test(line)) return "#9ad97f";
86
+ if (/^(codex|user|OpenAI Codex)/.test(line)) return "#c792ea";
87
+ if (/^#|^[-—]+$/.test(line)) return "#8a96a3";
88
+ return "#d8dee9";
89
+ }
90
+
91
+ function escapeXml(value) {
92
+ return String(value)
93
+ .replace(/&/g, "&amp;")
94
+ .replace(/</g, "&lt;")
95
+ .replace(/>/g, "&gt;")
96
+ .replace(/"/g, "&quot;");
97
+ }
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@minhpnq1807/contextos",
3
- "version": "0.5.12",
3
+ "version": "0.5.14",
4
4
  "description": "Task-aware AGENTS.md context injection and compliance reporting for Codex, Claude Code, and Antigravity.",
5
5
  "type": "module",
6
6
  "bin": {
7
- "ctx": "bin/ctx.js"
7
+ "ctx": "bin/ctx.js",
8
+ "ctx-codex": "bin/ctx.js"
8
9
  },
9
10
  "files": [
10
11
  "bin/",
@@ -12,6 +13,8 @@
12
13
  ".agents/",
13
14
  "README.md",
14
15
  "DEMO.md",
16
+ "LAUNCH.md",
17
+ "docs/",
15
18
  "LICENSE",
16
19
  "CHANGELOG.md"
17
20
  ],