contextos-agents 2.3.1 → 2.3.2

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.
Files changed (128) hide show
  1. package/.agents/adapters/cursor/export.js +3 -27
  2. package/.agents/adapters/gemini/export.js +5 -7
  3. package/.agents/adapters/shared.js +14 -1
  4. package/.agents/adapters/zed/export.js +4 -16
  5. package/.agents/compiled/registry.v2.json +33 -33
  6. package/.agents/compiled/registry.v2.sha256 +1 -1
  7. package/.agents/compiler/manifest-compiler.js +8 -5
  8. package/.agents/core/skills/context-manager/EXAMPLES.md +5 -17
  9. package/.agents/core/skills/context-manager/SKILL.md +10 -100
  10. package/.agents/core/skills/context-manager/TROUBLESHOOTING.md +6 -6
  11. package/.agents/core/skills/context-manager/VALIDATION.json +115 -4
  12. package/.agents/core/skills/context-manager/references/context-rules.md +3 -57
  13. package/.agents/core/skills/context-manager/skill.yaml +1 -3
  14. package/.agents/core/skills/context-os/EXAMPLES.md +25 -15
  15. package/.agents/core/skills/context-os/SKILL.md +12 -135
  16. package/.agents/core/skills/context-os/TROUBLESHOOTING.md +11 -6
  17. package/.agents/core/skills/context-os/VALIDATION.json +115 -4
  18. package/.agents/core/skills/context-os/packs.yaml +10 -59
  19. package/.agents/core/skills/context-os/references/context-rules.md +27 -59
  20. package/.agents/core/skills/context-os/references/pipeline.md +14 -119
  21. package/.agents/core/skills/context-os/references/project-graph.md +11 -100
  22. package/.agents/core/skills/context-os/rules.yaml +8 -135
  23. package/.agents/core/skills/engineering-workflow/EXAMPLES.md +15 -50
  24. package/.agents/core/skills/engineering-workflow/SKILL.md +10 -10
  25. package/.agents/core/skills/engineering-workflow/TROUBLESHOOTING.md +11 -19
  26. package/.agents/core/skills/engineering-workflow/VALIDATION.json +115 -4
  27. package/.agents/core/skills/engineering-workflow/references/workflow.md +55 -317
  28. package/.agents/core/skills/gemini-precision/EXAMPLES.md +33 -53
  29. package/.agents/core/skills/gemini-precision/SKILL.md +11 -147
  30. package/.agents/core/skills/gemini-precision/TROUBLESHOOTING.md +12 -25
  31. package/.agents/core/skills/gemini-precision/VALIDATION.json +115 -4
  32. package/.agents/core/skills/gemini-precision/skill.yaml +1 -1
  33. package/.agents/core/skills/gstack-roles/EXAMPLES.md +5 -21
  34. package/.agents/core/skills/gstack-roles/SKILL.md +10 -12
  35. package/.agents/core/skills/gstack-roles/TROUBLESHOOTING.md +6 -12
  36. package/.agents/core/skills/gstack-roles/VALIDATION.json +115 -4
  37. package/.agents/core/skills/gstack-roles/references/roles.md +3 -147
  38. package/.agents/core/skills/ponytail-mindset/EXAMPLES.md +12 -45
  39. package/.agents/core/skills/ponytail-mindset/SKILL.md +10 -13
  40. package/.agents/core/skills/ponytail-mindset/TROUBLESHOOTING.md +10 -19
  41. package/.agents/core/skills/ponytail-mindset/VALIDATION.json +115 -4
  42. package/.agents/core/skills/ponytail-mindset/references/minimalism.md +58 -174
  43. package/.agents/core/skills/security/EXAMPLES.md +19 -55
  44. package/.agents/core/skills/security/SKILL.md +61 -137
  45. package/.agents/core/skills/security/TROUBLESHOOTING.md +13 -19
  46. package/.agents/core/skills/security/VALIDATION.json +115 -4
  47. package/.agents/core/skills/security/skill.yaml +1 -1
  48. package/.agents/generated/claude/skills/context-manager/EXAMPLES.md +5 -17
  49. package/.agents/generated/claude/skills/context-manager/SKILL.md +9 -96
  50. package/.agents/generated/claude/skills/context-manager/TROUBLESHOOTING.md +6 -6
  51. package/.agents/generated/claude/skills/context-manager/VALIDATION.json +115 -4
  52. package/.agents/generated/claude/skills/context-manager/references/context-rules.md +3 -57
  53. package/.agents/generated/claude/skills/context-os/EXAMPLES.md +25 -15
  54. package/.agents/generated/claude/skills/context-os/SKILL.md +11 -133
  55. package/.agents/generated/claude/skills/context-os/TROUBLESHOOTING.md +11 -6
  56. package/.agents/generated/claude/skills/context-os/VALIDATION.json +115 -4
  57. package/.agents/generated/claude/skills/context-os/packs.yaml +10 -59
  58. package/.agents/generated/claude/skills/context-os/references/context-rules.md +27 -59
  59. package/.agents/generated/claude/skills/context-os/references/pipeline.md +14 -119
  60. package/.agents/generated/claude/skills/context-os/references/project-graph.md +11 -100
  61. package/.agents/generated/claude/skills/context-os/rules.yaml +8 -135
  62. package/.agents/generated/claude/skills/engineering-workflow/EXAMPLES.md +15 -50
  63. package/.agents/generated/claude/skills/engineering-workflow/SKILL.md +9 -9
  64. package/.agents/generated/claude/skills/engineering-workflow/TROUBLESHOOTING.md +11 -19
  65. package/.agents/generated/claude/skills/engineering-workflow/VALIDATION.json +115 -4
  66. package/.agents/generated/claude/skills/engineering-workflow/references/workflow.md +55 -317
  67. package/.agents/generated/claude/skills/gemini-precision/EXAMPLES.md +33 -53
  68. package/.agents/generated/claude/skills/gemini-precision/SKILL.md +10 -143
  69. package/.agents/generated/claude/skills/gemini-precision/TROUBLESHOOTING.md +12 -25
  70. package/.agents/generated/claude/skills/gemini-precision/VALIDATION.json +115 -4
  71. package/.agents/generated/claude/skills/gstack-roles/EXAMPLES.md +5 -21
  72. package/.agents/generated/claude/skills/gstack-roles/SKILL.md +9 -11
  73. package/.agents/generated/claude/skills/gstack-roles/TROUBLESHOOTING.md +6 -12
  74. package/.agents/generated/claude/skills/gstack-roles/VALIDATION.json +115 -4
  75. package/.agents/generated/claude/skills/gstack-roles/references/roles.md +3 -147
  76. package/.agents/generated/claude/skills/ponytail-mindset/EXAMPLES.md +12 -45
  77. package/.agents/generated/claude/skills/ponytail-mindset/SKILL.md +9 -12
  78. package/.agents/generated/claude/skills/ponytail-mindset/TROUBLESHOOTING.md +10 -19
  79. package/.agents/generated/claude/skills/ponytail-mindset/VALIDATION.json +115 -4
  80. package/.agents/generated/claude/skills/ponytail-mindset/references/minimalism.md +58 -174
  81. package/.agents/generated/claude/skills/security/EXAMPLES.md +19 -55
  82. package/.agents/generated/claude/skills/security/SKILL.md +60 -134
  83. package/.agents/generated/claude/skills/security/TROUBLESHOOTING.md +13 -19
  84. package/.agents/generated/claude/skills/security/VALIDATION.json +115 -4
  85. package/.agents/generated/gemini/skills/context-manager/EXAMPLES.md +5 -17
  86. package/.agents/generated/gemini/skills/context-manager/SKILL.md +10 -99
  87. package/.agents/generated/gemini/skills/context-manager/TROUBLESHOOTING.md +6 -6
  88. package/.agents/generated/gemini/skills/context-manager/VALIDATION.json +115 -4
  89. package/.agents/generated/gemini/skills/context-manager/references/context-rules.md +3 -57
  90. package/.agents/generated/gemini/skills/context-os/EXAMPLES.md +25 -15
  91. package/.agents/generated/gemini/skills/context-os/SKILL.md +12 -135
  92. package/.agents/generated/gemini/skills/context-os/TROUBLESHOOTING.md +11 -6
  93. package/.agents/generated/gemini/skills/context-os/VALIDATION.json +115 -4
  94. package/.agents/generated/gemini/skills/context-os/packs.yaml +10 -59
  95. package/.agents/generated/gemini/skills/context-os/references/context-rules.md +27 -59
  96. package/.agents/generated/gemini/skills/context-os/references/pipeline.md +14 -119
  97. package/.agents/generated/gemini/skills/context-os/references/project-graph.md +11 -100
  98. package/.agents/generated/gemini/skills/context-os/rules.yaml +8 -135
  99. package/.agents/generated/gemini/skills/engineering-workflow/EXAMPLES.md +15 -50
  100. package/.agents/generated/gemini/skills/engineering-workflow/SKILL.md +10 -11
  101. package/.agents/generated/gemini/skills/engineering-workflow/TROUBLESHOOTING.md +11 -19
  102. package/.agents/generated/gemini/skills/engineering-workflow/VALIDATION.json +115 -4
  103. package/.agents/generated/gemini/skills/engineering-workflow/references/workflow.md +55 -317
  104. package/.agents/generated/gemini/skills/gemini-precision/EXAMPLES.md +33 -53
  105. package/.agents/generated/gemini/skills/gemini-precision/SKILL.md +11 -145
  106. package/.agents/generated/gemini/skills/gemini-precision/TROUBLESHOOTING.md +12 -25
  107. package/.agents/generated/gemini/skills/gemini-precision/VALIDATION.json +115 -4
  108. package/.agents/generated/gemini/skills/gstack-roles/EXAMPLES.md +5 -21
  109. package/.agents/generated/gemini/skills/gstack-roles/SKILL.md +10 -13
  110. package/.agents/generated/gemini/skills/gstack-roles/TROUBLESHOOTING.md +6 -12
  111. package/.agents/generated/gemini/skills/gstack-roles/VALIDATION.json +115 -4
  112. package/.agents/generated/gemini/skills/gstack-roles/references/roles.md +3 -147
  113. package/.agents/generated/gemini/skills/ponytail-mindset/EXAMPLES.md +12 -45
  114. package/.agents/generated/gemini/skills/ponytail-mindset/SKILL.md +10 -14
  115. package/.agents/generated/gemini/skills/ponytail-mindset/TROUBLESHOOTING.md +10 -19
  116. package/.agents/generated/gemini/skills/ponytail-mindset/VALIDATION.json +115 -4
  117. package/.agents/generated/gemini/skills/ponytail-mindset/references/minimalism.md +58 -174
  118. package/.agents/generated/gemini/skills/security/EXAMPLES.md +19 -55
  119. package/.agents/generated/gemini/skills/security/SKILL.md +61 -136
  120. package/.agents/generated/gemini/skills/security/TROUBLESHOOTING.md +13 -19
  121. package/.agents/generated/gemini/skills/security/VALIDATION.json +115 -4
  122. package/.agents/resolver/canonical-resolver.js +34 -21
  123. package/.agents/rules/rule-catalog.js +5 -5
  124. package/.agents/validate.js +9 -2
  125. package/.agents/validation-evidence.js +89 -0
  126. package/README.md +132 -207
  127. package/catalog/skills/typescript/SKILL.md +16 -2
  128. package/package.json +3 -2
@@ -139,7 +139,7 @@ const BUILTIN_RULES = [
139
139
  level: 'must',
140
140
  enforcement: 'runtime',
141
141
  checker: 'secret-scanner',
142
- summary: 'Zero plaintext credentials, private keys, or API tokens committed to repository',
142
+ summary: 'Scan configured inputs for supported credential patterns; report input scope, exclusions, and scanner results',
143
143
  applicability: ['all'],
144
144
  priority: 100,
145
145
  tokenCost: 35,
@@ -276,9 +276,8 @@ const BUILTIN_RULES = [
276
276
  id: 'TEST-001',
277
277
  sourceSkill: 'testing',
278
278
  level: 'must',
279
- enforcement: 'runtime',
280
- checker: 'skill-frontmatter-validator',
281
- summary: 'Zero unverified claims: mandatory proof-of-work with automated test suite and validator execution',
279
+ enforcement: 'prompt-guidance',
280
+ summary: 'Report completion only with relevant behavioral evidence; document failed and unrun checks and their scope',
282
281
  applicability: ['all'],
283
282
  priority: 100,
284
283
  tokenCost: 45,
@@ -290,7 +289,7 @@ const BUILTIN_RULES = [
290
289
  sourceSkill: 'ponytail-mindset',
291
290
  level: 'must',
292
291
  enforcement: 'prompt-guidance',
293
- summary: 'Surgical blast radius: modify only files planned for the task; zero unnecessary boilerplate',
292
+ summary: 'Keep changes within the authorized outcome, update the plan for necessary callers, and preserve unrelated edits',
294
293
  applicability: ['all'],
295
294
  priority: 90,
296
295
  tokenCost: 35,
@@ -420,6 +419,7 @@ class RuleCatalog {
420
419
  lines.push(` Checker Module : ${checker.module}`);
421
420
  lines.push(` Checker Purpose : ${checker.description}`);
422
421
  }
422
+ lines.push(' Coverage Note : Registered checker; applies only when invoked on its configured inputs, not proof of the whole workflow.');
423
423
  } else {
424
424
  lines.push(` Enforcement Note : Governed via agent prompt guidelines (No runtime checker)`);
425
425
  }
@@ -413,14 +413,21 @@ function checkValidationJson(sourceSkills) {
413
413
  }
414
414
 
415
415
  try {
416
- JSON.parse(fs.readFileSync(valPath, 'utf8'));
416
+ const metadata = JSON.parse(fs.readFileSync(valPath, 'utf8'));
417
+ if (metadata['x-contextos-evidence-contract'] !== undefined) {
418
+ const issues = require('./validation-evidence.js').validateEvidenceSchema(metadata);
419
+ if (issues.length) {
420
+ error(`[validation] ${name}/VALIDATION.json: ${issues.join('; ')}`);
421
+ continue;
422
+ }
423
+ }
417
424
  pass++;
418
425
  } catch (e) {
419
426
  error(`[validation] ${name}/VALIDATION.json is invalid JSON: ${e.message}`);
420
427
  }
421
428
  }
422
429
 
423
- info(`[validation] ${pass} VALIDATION.json files are valid`);
430
+ info(`[validation] ${pass} metadata files structurally valid (not proof of command execution or agent behavior)`);
424
431
  }
425
432
 
426
433
  // ═════════════════════════════════════════════════════════════════════════════
@@ -0,0 +1,89 @@
1
+ 'use strict';
2
+
3
+ const fs = require('node:fs');
4
+ const { isDeepStrictEqual } = require('node:util');
5
+
6
+ // A report contract, not an attestation that a command was actually executed.
7
+ const EVIDENCE_REPORT_SCHEMA = {
8
+ $schema: 'http://json-schema.org/draft-07/schema#',
9
+ 'x-contextos-evidence-contract': 1,
10
+ title: 'Scoped verification evidence',
11
+ description: 'Report shape and outcome consistency only; command execution and agent behavior require separate evidence.',
12
+ type: 'object',
13
+ additionalProperties: false,
14
+ required: ['status', 'checks', 'limitations'],
15
+ properties: {
16
+ status: { enum: ['verified', 'partial', 'not_run'] },
17
+ checks: {
18
+ type: 'array',
19
+ items: {
20
+ type: 'object', additionalProperties: false,
21
+ required: ['command', 'exitCode', 'scope'],
22
+ properties: {
23
+ command: { type: 'string', minLength: 1 },
24
+ exitCode: { type: ['integer', 'null'] },
25
+ scope: { type: 'string', minLength: 1 },
26
+ },
27
+ },
28
+ },
29
+ limitations: { type: 'array', items: { type: 'string', minLength: 1 } },
30
+ },
31
+ allOf: [
32
+ {
33
+ if: { properties: { status: { const: 'verified' } } },
34
+ then: { properties: { checks: { minItems: 1, items: { properties: { exitCode: { const: 0 } } } } } },
35
+ },
36
+ {
37
+ if: { properties: { status: { enum: ['partial', 'not_run'] } } },
38
+ then: { properties: { limitations: { minItems: 1 } } },
39
+ },
40
+ {
41
+ if: { properties: { status: { const: 'not_run' } } },
42
+ then: { properties: { checks: { items: { properties: { exitCode: { type: 'null' } } } } } },
43
+ },
44
+ ],
45
+ };
46
+
47
+ function validateEvidenceSchema(schema) {
48
+ return isDeepStrictEqual(schema, EVIDENCE_REPORT_SCHEMA) ? [] : ['Evidence schema must match the version 1 report contract'];
49
+ }
50
+
51
+ function validateEvidenceReport(report) {
52
+ const errors = [];
53
+ const object = v => v && typeof v === 'object' && !Array.isArray(v);
54
+ const nonempty = v => typeof v === 'string' && v.trim().length > 0;
55
+ if (!object(report)) return ['Report must be an object'];
56
+ if (Object.keys(report).some(k => !['status', 'checks', 'limitations'].includes(k))) errors.push('Unknown report property');
57
+ if (!['verified', 'partial', 'not_run'].includes(report.status)) errors.push('Invalid status');
58
+ if (!Array.isArray(report.checks)) errors.push('checks must be an array');
59
+ else {
60
+ for (const [i, check] of report.checks.entries()) {
61
+ if (!object(check) || Object.keys(check).some(k => !['command', 'exitCode', 'scope'].includes(k)) ||
62
+ !nonempty(check.command) || !nonempty(check.scope) ||
63
+ !(check.exitCode === null || Number.isInteger(check.exitCode))) {
64
+ errors.push(`Invalid check at index ${i}`);
65
+ }
66
+ }
67
+ if (report.status === 'verified' && (!report.checks.length || report.checks.some(c => c?.exitCode !== 0))) {
68
+ errors.push('verified requires at least one successful check and no failed or unrun checks');
69
+ }
70
+ if (report.status === 'not_run' && report.checks.some(c => c?.exitCode !== null)) errors.push('not_run cannot contain executed checks');
71
+ }
72
+ if (!Array.isArray(report.limitations) || report.limitations.some(v => !nonempty(v))) errors.push('limitations must contain nonempty strings');
73
+ else if (report.status !== 'verified' && !report.limitations.length) errors.push('Partial or unrun work needs limitations');
74
+ return errors;
75
+ }
76
+
77
+ module.exports = { EVIDENCE_REPORT_SCHEMA, validateEvidenceSchema, validateEvidenceReport };
78
+
79
+ if (require.main === module) {
80
+ try {
81
+ const report = JSON.parse(fs.readFileSync(process.argv[2], 'utf8'));
82
+ const errors = validateEvidenceReport(report);
83
+ process.stdout.write(JSON.stringify({ ok: errors.length === 0, scope: 'report contract only', errors }) + '\n');
84
+ process.exitCode = errors.length ? 1 : 0;
85
+ } catch (err) {
86
+ process.stderr.write(err.message + '\n');
87
+ process.exitCode = 1;
88
+ }
89
+ }
package/README.md CHANGED
@@ -7,7 +7,8 @@
7
7
  <h1 align="center">contextos-agents</h1>
8
8
 
9
9
  <p align="center">
10
- <strong>One version-controlled source of engineering rules for supported coding agents.</strong>
10
+ <strong>Maintain your coding-agent rules in one place.</strong><br />
11
+ Export them to supported tools and catch outdated configs in CI.
11
12
  </p>
12
13
 
13
14
  <p align="center">
@@ -19,257 +20,181 @@
19
20
  </p>
20
21
 
21
22
  <p align="center">
22
- <a href="#installation">Installation</a> •
23
- <a href="./GUIDE.md">Guide</a> •
24
- <a href="./docs/product/onboarding.md">Onboarding</a> •
25
- <a href="./docs/ADAPTER_COMPATIBILITY.md">Adapters</a> •
26
- <a href="#supported-agents--compilation">Supported Agents</a> •
27
- <a href="./CONTRIBUTING.md">Contributing</a> •
28
- <a href="https://www.npmjs.com/package/contextos-agents">npm</a>
23
+ <a href="#quickstart">Quickstart</a> ·
24
+ <a href="#supported-agents">Supported agents</a> ·
25
+ <a href="./GUIDE.md">Guide</a> ·
26
+ <a href="./CONTRIBUTING.md">Contributing</a>
29
27
  </p>
30
28
 
31
29
  ---
32
30
 
33
- ContextOS is a deterministic context and policy compiler for AI coding agents. It exports version-controlled engineering rules and detects configuration drift in CI. See the [adapter compatibility matrix](docs/ADAPTER_COMPATIBILITY.md) for native paths, instruction indexes and manual templates; client loader verification is separate from export tests.
31
+ Using several coding agents in the same project? A rule updated for one tool can
32
+ leave another tool's configuration behind. ContextOS keeps your rules in
33
+ version-controlled Markdown, exports them to supported agent formats, and checks
34
+ whether those exports still match their sources.
34
35
 
35
- ## Installation
36
+ It is useful when you or your team maintain instructions across multiple tools
37
+ or need a configuration check before merging changes. If a small, stable
38
+ instruction file already covers your workflow, you may not need an extra tool.
36
39
 
37
- You do not need to clone anything manually. Just open your terminal in the root of your project and run:
38
-
39
- ```bash
40
- npx contextos-agents init
41
- ```
42
-
43
- By default, ContextOS installs seven core skills: `engineering-workflow`, `ponytail-mindset`, `gemini-precision`, `security`, `context-os`, `context-manager`, and `gstack-roles`, then exports Gemini workspace skills. Supporting examples and references remain separate files. The actual context loaded and session cost depend on your client and task; ContextOS does not control an external client's chat history.
44
-
45
- Codex also discovers the shared `.agents/skills` directory. The default Cursor
46
- export always applies only the compact project bootstrap; skill bodies load by
47
- file patterns or agent request. Resolver token budgets are soft: mandatory safety
48
- guidance survives with an overflow warning. The experimental MCP prompt assembler
49
- keeps selected bodies whole and can reject an explicit hard character limit.
50
-
51
- Want more skills right away? Install pre-packaged presets or the entire catalog:
52
-
53
- ```bash
54
- npx contextos-agents init --preset frontend # React, Next.js, TypeScript, UI/UX, a11y
55
- npx contextos-agents init --preset backend # System design, API design, Node.js, databases
56
- npx contextos-agents init --preset devops # Docker, CI/CD, Terraform
57
- npx contextos-agents init --all # Install all 36 catalog skills at once
58
- ```
59
-
60
- ### Options
61
-
62
- Try the [small local demo](examples/quickstart/README.md) to install the package in a new folder, select a TypeScript skill, and add a team rule without
63
- calling a model API. The [five-minute guide](docs/product/onboarding.md) explains
64
- the same workflow for an existing project.
65
-
66
- Core 2.3.1 / MCP 0.4.1 are being prepared as a maintenance release; they are not yet published.
67
- See the [candidate checklist](docs/PATCH_RELEASE_2.3.1.md) and
68
- [live client check](docs/LIVE_CLIENT_CHECK_RU.md).
69
- Core 2.3.0 and MCP 0.4.0 remain the published pair. See the [release status](docs/R2_RELEASE_PREPARATION.md)
70
- and [upgrade/checkpoint rollback](docs/COMPACT_CONTEXT_MIGRATION.md). The
71
- [release manifest](docs/evidence/release-2.3.json) records the released source,
72
- cross-platform CI and archive identities. Automatic client routing and the external
73
- pilot remain unverified. Internal plans, local API probes and raw logs are excluded
74
- from the public release surface.
75
-
76
- ```bash
77
- npx contextos-agents --help # Show all options
78
- npx contextos-agents --version # Show version
79
- npx contextos-agents --minimal # Install only the core bootstrap skills
80
- npx contextos-agents --all # Install all 36 catalog domain skills during init
81
- npx contextos-agents --preset <name> # Install stack preset: frontend, backend, devops, full
82
- npx contextos-agents --profile init # Install with specific profile
83
- npx contextos-agents --auto # Auto-detect tech stack and apply recommended profile
84
- npx contextos-agents --dry-run # Preview what will be installed
85
- npx contextos-agents --force # Overwrite an existing .agents/ folder
86
- npx contextos-agents --skip-compile # Skip auto-compilation step
87
- ```
88
-
89
- ## Why ContextOS?
90
-
91
- Modern development teams face fragmented AI tooling: engineers use Cursor, Claude Code, GitHub Copilot, Gemini, Zed, and Aider. Each tool requires its own proprietary rules format, leading to configuration drift, contradictory standards, and unvetted AI slop (`// TODO`, leaked secrets).
92
-
93
- ContextOS preserves selected skill bodies and reports budget overflow instead of silently truncating required instructions. Whether a client loads and follows those rules requires separate verification. The current [calibration](docs/BENCHMARK_RESULTS.md) found no quality advantage over vanilla on its test corpus.
94
-
95
- **ContextOS is not another coding agent.** It is the deterministic context compiler and policy engine for the agents your team already uses.
96
-
97
- ### The Three Pillars
98
-
99
- 1. **Portable (Multi-Agent):** Define your engineering skills once in standard Markdown. ContextOS generates agent-specific exports (Gemini, Claude Code, Cursor, Copilot, Aider, and Zed); native loading and manual templates are distinguished in the compatibility matrix.
100
- 2. **High-Fidelity & Focused:** The resolver maps domain skills to relevant tasks without lossy truncation, delivering rich, complete context to the model.
101
- 3. **Verifiable in CI:** Lockfile v2 provenance, dual-hash verification, and CI quality gates detect configuration drift and enforce quality guardrails before merge.
102
-
103
- ## How it works
104
-
105
- 1. Define version-controlled engineering policies once.
106
- 2. Resolve the complete, relevant skill policies for the current task.
107
- 3. Compile native configuration for each coding agent.
108
- 4. Detect configuration drift and policy violations in CI.
109
-
110
- ```bash
111
- contextos resolve "review authentication changes" \
112
- --files src/auth/session.ts \
113
- --explain
114
- ```
115
-
116
- Example excerpt from the repository configuration (selection and scores depend on installed skills, files and profile):
117
-
118
- ```text
119
- Selected Skills:
120
- ✓ engineering-workflow score: 100 tokens: ~418 (foundation: Core skill)
121
- ✓ security score: 185 tokens: ~2237 (safety_required: Touched file "src/auth/session.ts" matches glob "**/*auth*" (+25); safety_required: Touched file "src/auth/session.ts" matches pattern (+60); safety_required: Required safety guidance for high risk task)
122
- ✓ typescript score: 60 tokens: ~1000 (file_glob: Touched file "src/auth/session.ts" matches pattern (+60))
123
- ```
124
-
125
- Selection does not imply installation or activation. If TypeScript is not installed, the CLI also reports `CTX_SELECTED_SKILL_UNAVAILABLE`; install it with `contextos skill add typescript` before runtime assembly.
126
-
127
- ## Dynamic Skill Resolution & Unified CLI (`contextos` / `ctx.js`)
128
-
129
- ContextOS provides a unified CLI (`contextos` or `npx contextos-agents`) and local engine (`.agents/ctx.js`) to resolve minimal skills on the fly, run health diagnostics, and compile exports for AI assistants.
130
-
131
- ### Dynamic Skill Resolution (`resolve`)
132
-
133
- ```bash
134
- # Resolve skills for a task description:
135
- contextos resolve "Build an accessible modal component with React and Tailwind"
136
-
137
- # Output:
138
- # [DOMAIN: Frontend] [PHASE: Build] [ROLE: Senior Developer] [MODE: CHANGE] [LENSES: accessibility] [RISK: standard]
139
- # Skills loaded: ponytail-mindset, engineering-workflow, react, web-accessibility, ui-ux-pro
140
- # Selection declaration only; skill bodies are read by the consuming client or prompt assembler.
141
-
142
- # Resolve with full evidence scoring explanation:
143
- contextos resolve "security review" --files apps/web/app/login/page.tsx --explain
144
- ```
145
-
146
- ### Skill & Catalog Management (`contextos skill`)
147
-
148
- Discover, install, and customize skills:
40
+ <p align="center">
41
+ <img src="./assets/contextos-story.gif" alt="One rule changed. Three agent configs fell behind. ContextOS detects stale exports, then refreshes and verifies them." width="960" />
42
+ </p>
149
43
 
150
- ```bash
151
- # Explore all available catalog skills (36 domain skills):
152
- contextos skill list --available
44
+ <p align="center"><sub>Change a rule. Catch stale exports. Bring them back in sync.</sub></p>
153
45
 
154
- # Install a specific skill from the catalog (with typo suggestions):
155
- contextos skill add fastapi
46
+ <a id="installation"></a>
156
47
 
157
- # Install all 36 catalog skills at once:
158
- contextos skill add --all
48
+ ## Quickstart
159
49
 
160
- # Fork a built-in skill into your project for team customizations:
161
- contextos skill override gemini-precision
50
+ Requires **Node.js 22+** and npm. Run these commands in your project's root.
51
+ This workflow does not call a model API.
162
52
 
163
- # Diff your local customizations against upstream updates:
164
- contextos skill diff gemini-precision
53
+ **1. Initialize the rule sources.**
165
54
 
166
- # Eject a skill to decouple it from upstream updates:
167
- contextos skill eject gemini-precision
55
+ ```sh
56
+ npx contextos-agents init --skip-compile
168
57
  ```
169
58
 
170
- ### Diagnostic Health Check (`contextos doctor`)
171
-
172
- Run a comprehensive pre-flight verification across your repository to ensure valid skills, profile alignment, and compiler synchronization:
59
+ This installs the seven core skills. We generate the agent files after adding
60
+ your own rule below. See the [guide](GUIDE.md#initialization-options) for presets,
61
+ installation previews, and using a pinned project dependency.
173
62
 
174
- ```bash
175
- contextos doctor
176
- ```
63
+ **2. Add a rule your team wants to maintain.**
177
64
 
178
- ### Supported Agents & Compilation
65
+ Create the folders and save this as
66
+ `.agents/project/skills/team-auth/SKILL.md`:
179
67
 
180
- | Agent | Command | Output Format |
181
- |-------|---------|---------------|
182
- | **Gemini / Antigravity** | `contextos export gemini` | `.agents/generated/gemini/skills/` |
183
- | **Claude Code** | `contextos export claude` | `.agents/generated/claude/skills/` |
184
- | **Cursor IDE** | `contextos export cursor` | `.cursor/rules/*.mdc` (modular globs) + `.cursorrules` |
185
- | **GitHub Copilot** | `contextos export copilot` | `.github/copilot-instructions.md` |
186
- | **Aider** | `contextos export aider` | `.aider.conf.yml` + `CONVENTIONS.md` |
187
- | **Zed IDE** | `contextos export zed` | `.zed/rules.md` + `.zed/prompts/*.md` |
68
+ ```markdown
69
+ ---
70
+ name: team-auth
71
+ description: Team rules for authentication code.
72
+ ---
73
+ # Team security
188
74
 
189
- ```bash
190
- contextos export all # Compile for all agents
75
+ - Never log authorization headers.
191
76
  ```
192
77
 
193
- ### Staged Index Security Scanner (`contextos scan`)
194
-
195
- Scan staged changes directly from the Git index for secret leaks, blocked credential files, unfinished lazy stubs, and write-scope containment:
78
+ **3. Compile, export, and check.**
196
79
 
197
- ```bash
198
- contextos scan --staged --enforce
199
- contextos scan --staged --placeholders --scope .agents/task-scope.json --json
80
+ ```sh
81
+ npx contextos-agents compile
82
+ npx contextos-agents export all
83
+ npx contextos-agents export all --check --json
200
84
  ```
201
85
 
202
- ### Safe Git Pre-Commit Hooks (`contextos hook`)
86
+ The check should report `"status": "pass"`, `"hasDrift": false`, and exit code
87
+ `0`. The rule is now present in generated files such as
88
+ `.cursor/rules/team-auth.mdc` and `.agents/skills/team-auth/SKILL.md`.
203
89
 
204
- Install or remove isolated pre-commit hooks that run fast security checks without clobbering existing developer hooks:
90
+ **See drift detection:** add `- Never log session tokens.` to the same source
91
+ file, then run:
205
92
 
206
- ```bash
207
- contextos hook install
208
- contextos hook uninstall
93
+ ```sh
94
+ npx contextos-agents compile
95
+ npx contextos-agents export all --check --json
209
96
  ```
210
97
 
211
- ### CI Quality Gate (`contextos gate`)
98
+ The check now reports `"status": "drift"` and exits with code `1`: the exports
99
+ are out of date. Run `npx contextos-agents export all` and check again to return
100
+ to `pass`. Commit the source rules, generated files, and lockfile together.
212
101
 
213
- Check that generated adapter files match source skills and the active profile:
102
+ Edit your rules under `.agents/project/skills/`; generated files are managed
103
+ outputs. To use a single adapter, replace `all` with its name, for example
104
+ `cursor`. See the [step-by-step onboarding guide](docs/product/onboarding.md)
105
+ for task selection, client activation, updates, and removal.
214
106
 
215
- ```bash
216
- contextos gate
217
- ```
107
+ ## Check rule changes in CI
218
108
 
219
- This is a configuration drift gate. Run your application's tests, typecheck and security checks separately. `resolve` recommends skills for a task; ordinary exports use all installed skills allowed by the profile. Resolver budgets are soft estimates of selected skill bodies and exclude client instructions, chat history and tool output.
109
+ After committing a fresh export, run the same consistency check on pull requests.
110
+ It checks agent configuration; your application's tests and security checks
111
+ remain separate.
220
112
 
221
- ### CI Quality Gate Action (contextos-gate)
113
+ <details>
114
+ <summary>GitHub Actions example</summary>
222
115
 
223
- Guard your repository against skill drift, missing outputs, and rule regressions using the official GitHub Composite Action:
116
+ Save as `.github/workflows/contextos.yml`:
224
117
 
225
118
  ```yaml
226
- # .github/workflows/pr-gate.yml
227
- name: ContextOS Quality Gate
119
+ name: Agent rule consistency
228
120
  on: [pull_request, push]
229
121
  jobs:
230
- gate:
122
+ check:
231
123
  runs-on: ubuntu-latest
232
124
  steps:
233
125
  - uses: actions/checkout@v4
234
- - uses: kok-o/contextos-agents/.github/actions/contextos-gate@v2.3.1
126
+ - uses: kok-o/contextos-agents/.github/actions/contextos-gate@v2.3.2
235
127
  with:
236
- version: '2.3.1' # Pinned version of contextos-agents runner
237
- adapters: 'all' # Adapters to verify (or specific: 'cursor', 'claude')
238
- working-directory: '.' # Project root directory
239
- ```
240
-
241
- The example targets the forthcoming v2.3.1 release; use it after that tag and package are published.
242
- Until then, keep both pins at v2.3.0 / 2.3.0. The existing `v2.3.0` action tag defaults to CLI 2.2.0,
243
- so retain the explicit `version`. Updating the action source does not change an existing tag.
244
-
245
- The action executes the verified ContextOS quality gate in-process from the pinned package version, verifying generated AI adapter configs against source skills without executing untrusted scripts from pull requests, and without requiring a Node.js project or running `npm test`.
246
-
247
- ## Optional MCP integration (Beta)
248
-
249
- The MCP server is a separate beta package. It is not part of the stable `contextos-agents` core.
250
-
251
- Install it separately if you want to try the beta integration:
252
-
253
- ```bash
254
- npm install --save-dev contextos-mcp
255
- npx contextos-mcp --dir .
128
+ version: '2.3.2'
129
+ adapters: 'all'
130
+ working-directory: '.'
256
131
  ```
257
132
 
258
- The former `@contextos/mcp` 0.3.x package is historical; use `contextos-mcp` for current releases.
259
-
260
- The MCP server is read-only by default. Runtime execution remains experimental and is outside the stable core scope.
261
-
262
- ## Security - Third-Party Skills
263
-
264
- ContextOS skills are **executable context** - they become part of the system prompt that controls your AI agent's behavior. A malicious skill could instruct the AI agent to exfiltrate environment variables, modify files, or ignore your project's security policies.
265
-
266
- > [!CAUTION]
267
- > **Install skills only from repositories you trust as you would trust executable code.** Skills installed via `ctx.js skill add` from npm or GitHub are not sandboxed.
133
+ Set `adapters` to the adapter or adapters you actually exported.
134
+ See [CI configuration](GUIDE.md#ci-configuration-check) for version pinning.
135
+
136
+ </details>
137
+
138
+ <a id="supported-agents--compilation"></a>
139
+
140
+ ## Supported agents
141
+
142
+ | Agent | How ContextOS provides the rules |
143
+ | --- | --- |
144
+ | Codex | Shared native skills in `.agents/skills/*/SKILL.md`. |
145
+ | Gemini CLI | Shared workspace skills plus Gemini exports. |
146
+ | Claude Code | `CLAUDE.md` index linking to generated instructions. |
147
+ | Cursor | Modular `.cursor/rules/*.mdc` files. |
148
+ | GitHub Copilot | Repository instructions and a skill source index. |
149
+ | Aider | `CONVENTIONS.md` referenced by `.aider.conf.yml`. |
150
+ | Zed | Templates for manual import. |
151
+
152
+ Export tests and live client loading are separate checks. See the
153
+ [compatibility matrix](docs/ADAPTER_COMPATIBILITY.md) for exact paths, tested
154
+ client versions, and limitations, including unverified Antigravity loading.
155
+
156
+ ## Beyond the first rule
157
+
158
+ - **Reuse skills:** install catalog skills and stack presets, or keep team
159
+ overrides. See [skill management](GUIDE.md#skill--catalog-management-skill).
160
+ - **Inspect task relevance:** `resolve` recommends skills for a task and explains
161
+ the selection. It does not install or activate them. Ordinary exports use the
162
+ installed skills allowed by the profile, independently of a task's selection.
163
+ See [resolution](GUIDE.md#dynamic-skill-resolution-resolve).
164
+ - **Inspect staged changes:** the separate `scan` command and optional hooks
165
+ check supported secret, placeholder, and write-scope patterns. See
166
+ [scanning and hooks](GUIDE.md#security-scanning--governance-hooks).
167
+
168
+ ## Scope and evidence
169
+
170
+ The core CLI manages rule sources, selection, exports, and configuration checks.
171
+ The optional [MCP package](contextos-mcp/README.md) is separate and in beta
172
+ (`npm install --save-dev contextos-mcp`); agent execution and runtime orchestration
173
+ remain experimental.
174
+
175
+ Consistent configuration does not guarantee that a model follows every rule.
176
+ The [recorded calibration](docs/BENCHMARK_RESULTS.md) found no quality advantage
177
+ over vanilla on its test corpus. Install third-party skills only from sources
178
+ you trust: their instructions are not sandboxed.
179
+
180
+ ## Documentation
181
+
182
+ | I want to… | Read |
183
+ | --- | --- |
184
+ | Look up commands, presets, profiles, and diagnostics | [Guide and cheat sheet](GUIDE.md) |
185
+ | Try a task with a custom team rule | [Onboarding](docs/product/onboarding.md) |
186
+ | Check agent-specific behavior | [Compatibility matrix](docs/ADAPTER_COMPATIBILITY.md) |
187
+ | Understand the compiler and support boundaries | [Architecture](docs/ARCHITECTURE.md) · [Product boundaries](docs/PRODUCT_BOUNDARIES.md) |
188
+ | Upgrade or recover a previous configuration | [Migration and rollback](docs/COMPACT_CONTEXT_MIGRATION.md) |
189
+ | Review release evidence | [2.3.2 maintenance release](docs/PATCH_RELEASE_2.3.2.md) · [Changelog](CHANGELOG.md) |
190
+ | Reproduce the animated example | [Demo commands and renderer](scripts/readme-gif/STORY.md) |
268
191
 
269
192
  ## Contributing
270
193
 
271
- We are open to pull requests! See [CONTRIBUTING.md](./CONTRIBUTING.md) for a step-by-step guide.
194
+ Bug reports, documentation fixes, and examples from real projects are welcome.
195
+ See [CONTRIBUTING.md](CONTRIBUTING.md) or
196
+ [open an issue](https://github.com/kok-o/contextos-agents/issues).
272
197
 
273
198
  ## License
274
199
 
275
- Distributed under the Apache License, Version 2.0. See [LICENSE](./LICENSE) and [NOTICE](./NOTICE) for details.
200
+ [Apache-2.0](LICENSE). See [NOTICE](NOTICE) for attribution.
@@ -68,9 +68,23 @@ type Result<T> = { ok: true; data: T } | { ok: false; error: string };
68
68
 
69
69
  ## Type Guards
70
70
 
71
+ A type guard must validate every required property before narrowing. This checks
72
+ the data shape; a supplied `role` does not establish authorization.
73
+
74
+ <!-- example: typescript-user-guard -->
75
+
71
76
  ```typescript
72
- function isUser(value: unknown): value is User {
73
- return typeof value === 'object' && value !== null && 'id' in value;
77
+ export interface User {
78
+ id: string;
79
+ name: string;
80
+ role: 'admin' | 'user';
81
+ }
82
+
83
+ export function isUser(value: unknown): value is User {
84
+ return typeof value === 'object' && value !== null && !Array.isArray(value)
85
+ && 'id' in value && typeof value.id === 'string'
86
+ && 'name' in value && typeof value.name === 'string'
87
+ && 'role' in value && (value.role === 'admin' || value.role === 'user');
74
88
  }
75
89
  ```
76
90
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contextos-agents",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "Deterministic context and policy compiler for supported AI coding agents.",
5
5
  "bin": {
6
6
  "contextos": "./bin/index.js",
@@ -18,6 +18,7 @@
18
18
  ".agents/skills.json",
19
19
  ".agents/ctx.js",
20
20
  ".agents/validate.js",
21
+ ".agents/validation-evidence.js",
21
22
  ".agents/plugins.js",
22
23
  ".agents/profiles.js",
23
24
  ".agents/resolver.js",
@@ -53,7 +54,7 @@
53
54
  "setup:hooks": "node scripts/install-hooks.js",
54
55
  "watch": "node .agents/watch.js",
55
56
  "test:skills": "node scripts/verify-skill-examples.js",
56
- "test": "node --test --test-concurrency=1 tests/install.test.js tests/lockfile.test.js tests/safe-writer.test.js tests/adapter-safety.test.js tests/update.test.js tests/uninstall.test.js tests/plugin-security.test.js tests/export.test.js tests/skills.test.js tests/validate.test.js tests/plugins.test.js tests/benchmark.test.js tests/benchmark-api.test.js tests/profile.test.js tests/resolver.test.js tests/cli-registry.test.js tests/profile-enforcement.test.js tests/doctor-hardening.test.js tests/manifest-compiler.test.js tests/canonical-resolver.test.js tests/workspace-graph.test.js tests/profiles-v2.test.js tests/safe-path.test.js tests/project-lock.test.js tests/journaled-transaction.test.js tests/pure-adapters.test.js tests/prompt-skill-system.test.js tests/runtime-state-machine.test.js tests/verification-reviewer-pipeline.test.js tests/durable-concurrency-locks.test.js tests/transactional-git.test.js tests/sandbox-execution.test.js tests/plugin-supply-chain.test.js tests/platform-hardening.test.js tests/customization-dx.test.js tests/claims-governance.test.js tests/benchmark-v2.test.js tests/init-engine.test.js tests/mutation-paths.test.js tests/tarball-smoke.test.js tests/catalog-export-integration.test.js tests/consumer-gate.test.js tests/adapter-compatibility.test.js tests/consumer-init.test.js tests/skill-examples.test.js tests/scan.test.js tests/hooks.test.js tests/recovery-cli.test.js tests/doctor-v2.test.js tests/resolver-parity.test.js tests/watch-coalescing.test.js tests/consumer-stabilization.test.js tests/focused-context.test.js tests/spend-guard.test.js tests/maintenance-benchmark.test.js tests/luna-agent-benchmark.test.js tests/release-surface.test.js",
57
+ "test": "node --test --test-concurrency=1 tests/install.test.js tests/lockfile.test.js tests/safe-writer.test.js tests/adapter-safety.test.js tests/update.test.js tests/uninstall.test.js tests/plugin-security.test.js tests/export.test.js tests/skills.test.js tests/validate.test.js tests/plugins.test.js tests/benchmark.test.js tests/benchmark-api.test.js tests/profile.test.js tests/resolver.test.js tests/cli-registry.test.js tests/profile-enforcement.test.js tests/doctor-hardening.test.js tests/manifest-compiler.test.js tests/canonical-resolver.test.js tests/workspace-graph.test.js tests/profiles-v2.test.js tests/safe-path.test.js tests/project-lock.test.js tests/journaled-transaction.test.js tests/pure-adapters.test.js tests/prompt-skill-system.test.js tests/runtime-state-machine.test.js tests/verification-reviewer-pipeline.test.js tests/durable-concurrency-locks.test.js tests/transactional-git.test.js tests/sandbox-execution.test.js tests/plugin-supply-chain.test.js tests/platform-hardening.test.js tests/customization-dx.test.js tests/claims-governance.test.js tests/benchmark-v2.test.js tests/init-engine.test.js tests/mutation-paths.test.js tests/tarball-smoke.test.js tests/catalog-export-integration.test.js tests/consumer-gate.test.js tests/adapter-compatibility.test.js tests/consumer-init.test.js tests/skill-examples.test.js tests/scan.test.js tests/hooks.test.js tests/recovery-cli.test.js tests/doctor-v2.test.js tests/resolver-parity.test.js tests/watch-coalescing.test.js tests/consumer-stabilization.test.js tests/focused-context.test.js tests/spend-guard.test.js tests/maintenance-benchmark.test.js tests/luna-agent-benchmark.test.js tests/release-surface.test.js tests/core-skill-standard.test.js",
57
58
  "prepublishOnly": "npm run validate && npm run build"
58
59
  },
59
60
  "keywords": [