contextos-agents 2.3.0 → 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 (129) 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 -197
  127. package/bin/index.js +1 -1
  128. package/catalog/skills/typescript/SKILL.md +16 -2
  129. package/package.json +90 -89
@@ -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,247 +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 current
63
- candidate in a new folder, select a TypeScript skill, and add a team rule without
64
- calling a model API. The [five-minute guide](docs/product/onboarding.md) explains
65
- the same workflow for an existing project.
66
-
67
- For the current R2 candidates, see the [release preparation status](docs/R2_RELEASE_PREPARATION.md)
68
- and [upgrade/checkpoint rollback](docs/COMPACT_CONTEXT_MIGRATION.md). The
69
- [release manifest](docs/evidence/release-2.3.json) records the verified source,
70
- cross-platform CI and candidate archive identities. The client pilot and
71
- publication decision remain pending. Internal plans, local API probes
72
- and raw logs are excluded from the public release surface.
73
-
74
- ```bash
75
- npx contextos-agents --help # Show all options
76
- npx contextos-agents --version # Show version
77
- npx contextos-agents --minimal # Install only the core bootstrap skills
78
- npx contextos-agents --all # Install all 36 catalog domain skills during init
79
- npx contextos-agents --preset <name> # Install stack preset: frontend, backend, devops, full
80
- npx contextos-agents --profile init # Install with specific profile
81
- npx contextos-agents --auto # Auto-detect tech stack and apply recommended profile
82
- npx contextos-agents --dry-run # Preview what will be installed
83
- npx contextos-agents --force # Overwrite an existing .agents/ folder
84
- npx contextos-agents --skip-compile # Skip auto-compilation step
85
- ```
86
-
87
- ## Why ContextOS?
88
-
89
- 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).
90
-
91
- Artificially truncating skills to save tokens degrades model reasoning and induces hallucinations. Instead, ContextOS ensures that agents receive complete, high-fidelity engineering context from a single version-controlled source.
92
-
93
- **ContextOS is not another coding agent.** It is the deterministic context compiler and policy engine for the agents your team already uses.
94
-
95
- ### The Three Pillars
96
-
97
- 1. **Portable (Multi-Agent):** Define your engineering skills once in standard Markdown. ContextOS compiles native configurations for all supported agents (Gemini, Claude Code, Cursor, Copilot, Aider, and Zed).
98
- 2. **High-Fidelity & Focused:** The resolver maps domain skills to relevant tasks without lossy truncation, delivering rich, complete context to the model.
99
- 3. **Verifiable in CI:** Lockfile v2 provenance, dual-hash verification, and CI quality gates detect configuration drift and enforce quality guardrails before merge.
100
-
101
- ## How it works
102
-
103
- 1. Define version-controlled engineering policies once.
104
- 2. Resolve the complete, relevant skill policies for the current task.
105
- 3. Compile native configuration for each coding agent.
106
- 4. Detect configuration drift and policy violations in CI.
107
-
108
- ```bash
109
- contextos resolve "review authentication changes" \
110
- --files src/auth/session.ts \
111
- --explain
112
- ```
113
-
114
- Selected:
115
- security explicit task match
116
- engineering-workflow required dependency
117
-
118
- Excluded:
119
- context-manager domain relevance filter
120
-
121
- Risk: high
122
- Context status: complete and verified
123
-
124
- ## Dynamic Skill Resolution & Unified CLI (`contextos` / `ctx.js`)
125
-
126
- 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.
127
-
128
- ### Dynamic Skill Resolution (`resolve`)
129
-
130
- ```bash
131
- # Resolve skills for a task description:
132
- contextos resolve "Build an accessible modal component with React and Tailwind"
133
-
134
- # Output:
135
- # [DOMAIN: Frontend] [PHASE: Build] [ROLE: Senior Developer]
136
- # Skills loaded: ponytail-mindset, engineering-workflow, gemini-precision
137
-
138
- # Resolve with full evidence scoring explanation:
139
- contextos resolve "security review" --files apps/web/app/login/page.tsx --explain
140
- ```
141
-
142
- ### Skill & Catalog Management (`contextos skill`)
143
-
144
- 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>
145
43
 
146
- ```bash
147
- # Explore all available catalog skills (36 domain skills):
148
- contextos skill list --available
44
+ <p align="center"><sub>Change a rule. Catch stale exports. Bring them back in sync.</sub></p>
149
45
 
150
- # Install a specific skill from the catalog (with typo suggestions):
151
- contextos skill add fastapi
46
+ <a id="installation"></a>
152
47
 
153
- # Install all 36 catalog skills at once:
154
- contextos skill add --all
48
+ ## Quickstart
155
49
 
156
- # Fork a built-in skill into your project for team customizations:
157
- 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.
158
52
 
159
- # Diff your local customizations against upstream updates:
160
- contextos skill diff gemini-precision
53
+ **1. Initialize the rule sources.**
161
54
 
162
- # Eject a skill to decouple it from upstream updates:
163
- contextos skill eject gemini-precision
55
+ ```sh
56
+ npx contextos-agents init --skip-compile
164
57
  ```
165
58
 
166
- ### Diagnostic Health Check (`contextos doctor`)
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.
167
62
 
168
- Run a comprehensive pre-flight verification across your repository to ensure valid skills, profile alignment, and compiler synchronization:
63
+ **2. Add a rule your team wants to maintain.**
169
64
 
170
- ```bash
171
- contextos doctor
172
- ```
173
-
174
- ### Supported Agents & Compilation
65
+ Create the folders and save this as
66
+ `.agents/project/skills/team-auth/SKILL.md`:
175
67
 
176
- | Agent | Command | Output Format |
177
- |-------|---------|---------------|
178
- | **Gemini / Antigravity** | `contextos export gemini` | `.agents/generated/gemini/skills/` |
179
- | **Claude Code** | `contextos export claude` | `.agents/generated/claude/skills/` |
180
- | **Cursor IDE** | `contextos export cursor` | `.cursor/rules/*.mdc` (modular globs) + `.cursorrules` |
181
- | **GitHub Copilot** | `contextos export copilot` | `.github/copilot-instructions.md` |
182
- | **Aider** | `contextos export aider` | `.aider.conf.yml` + `CONVENTIONS.md` |
183
- | **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
184
74
 
185
- ```bash
186
- contextos export all # Compile for all agents
75
+ - Never log authorization headers.
187
76
  ```
188
77
 
189
- ### Staged Index Security Scanner (`contextos scan`)
190
-
191
- 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.**
192
79
 
193
- ```bash
194
- contextos scan --staged --enforce
195
- 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
196
84
  ```
197
85
 
198
- ### 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`.
199
89
 
200
- 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:
201
92
 
202
- ```bash
203
- contextos hook install
204
- contextos hook uninstall
93
+ ```sh
94
+ npx contextos-agents compile
95
+ npx contextos-agents export all --check --json
205
96
  ```
206
97
 
207
- ### 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.
208
101
 
209
- 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.
210
106
 
211
- ```bash
212
- contextos gate
213
- ```
107
+ ## Check rule changes in CI
214
108
 
215
- 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.
216
112
 
217
- ### CI Quality Gate Action (contextos-gate)
113
+ <details>
114
+ <summary>GitHub Actions example</summary>
218
115
 
219
- Guard your repository against skill drift, missing outputs, and rule regressions using the official GitHub Composite Action:
116
+ Save as `.github/workflows/contextos.yml`:
220
117
 
221
118
  ```yaml
222
- # .github/workflows/pr-gate.yml
223
- name: ContextOS Quality Gate
119
+ name: Agent rule consistency
224
120
  on: [pull_request, push]
225
121
  jobs:
226
- gate:
122
+ check:
227
123
  runs-on: ubuntu-latest
228
124
  steps:
229
125
  - uses: actions/checkout@v4
230
- - uses: kok-o/contextos-agents/.github/actions/contextos-gate@v2.2.0
126
+ - uses: kok-o/contextos-agents/.github/actions/contextos-gate@v2.3.2
231
127
  with:
232
- version: '2.2.0' # Pinned version of contextos-agents runner
233
- adapters: 'all' # Adapters to verify (or specific: 'cursor', 'claude')
234
- working-directory: '.' # Project root directory
235
- ```
236
-
237
- 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`.
238
-
239
- ## Optional MCP integration (Beta)
240
-
241
- The MCP server is a separate beta package. It is not part of the stable `contextos-agents` core.
242
-
243
- Install it separately if you want to try the beta integration:
244
-
245
- ```bash
246
- npm install --save-dev @contextos/mcp
247
- npx contextos-mcp --dir .
128
+ version: '2.3.2'
129
+ adapters: 'all'
130
+ working-directory: '.'
248
131
  ```
249
132
 
250
- The MCP server is read-only by default. Runtime execution remains experimental and is outside the stable core scope.
251
-
252
- ## Security - Third-Party Skills
253
-
254
- 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.
255
-
256
- > [!CAUTION]
257
- > **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) |
258
191
 
259
192
  ## Contributing
260
193
 
261
- 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).
262
197
 
263
198
  ## License
264
199
 
265
- 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.
package/bin/index.js CHANGED
@@ -100,7 +100,7 @@ Options:
100
100
  --project <path> Specify target project root directory (default: current directory)
101
101
  --target <adapters> Target adapter(s) to verify or export (default: all)
102
102
  --github-annotations Emit GitHub Actions workflow commands and step summary
103
- --with-mcp, --mcp [DEPRECATED] Use the separate @contextos/mcp package instead
103
+ --with-mcp, --mcp [DEPRECATED] Use the separate contextos-mcp package instead
104
104
  --skip-compile Skip running ctx.js export after installation
105
105
  --add-skill <ref> Install a community plugin skill after setup
106
106
 
@@ -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