@compr/opscontext-mcp 2.0.0
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 +313 -0
- package/LICENSE +83 -0
- package/README.md +470 -0
- package/defaults/learnings.json +146 -0
- package/dist/activation.d.ts +48 -0
- package/dist/activation.js +377 -0
- package/dist/adapters.d.ts +101 -0
- package/dist/adapters.js +171 -0
- package/dist/agents.d.ts +137 -0
- package/dist/agents.js +1638 -0
- package/dist/audit.d.ts +23 -0
- package/dist/audit.js +163 -0
- package/dist/cache.d.ts +15 -0
- package/dist/cache.js +117 -0
- package/dist/claude-integration.d.ts +95 -0
- package/dist/claude-integration.js +247 -0
- package/dist/cli.d.ts +18 -0
- package/dist/cli.js +1823 -0
- package/dist/code-chunker.d.ts +12 -0
- package/dist/code-chunker.js +270 -0
- package/dist/collectors.d.ts +63 -0
- package/dist/collectors.js +617 -0
- package/dist/config.d.ts +73 -0
- package/dist/config.js +239 -0
- package/dist/embeddings.d.ts +36 -0
- package/dist/embeddings.js +124 -0
- package/dist/firewall.d.ts +133 -0
- package/dist/firewall.js +631 -0
- package/dist/hooks.d.ts +76 -0
- package/dist/hooks.js +313 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1081 -0
- package/dist/ingest.d.ts +32 -0
- package/dist/ingest.js +162 -0
- package/dist/learnings.d.ts +108 -0
- package/dist/learnings.js +714 -0
- package/dist/license-sig.d.ts +47 -0
- package/dist/license-sig.js +104 -0
- package/dist/policy.d.ts +131 -0
- package/dist/policy.js +182 -0
- package/dist/search.d.ts +11 -0
- package/dist/search.js +99 -0
- package/dist/sessions.d.ts +46 -0
- package/dist/sessions.js +153 -0
- package/examples/adapters/notion-adapter.js +108 -0
- package/examples/adapters/rss-adapter.js +76 -0
- package/package.json +87 -0
- package/skills/opscontext/SKILL.md +260 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to OpsContext for AI Agents (previously ContextEngine — MCP server + CLI) are documented here.
|
|
4
|
+
|
|
5
|
+
## [2.0.0] — 2026-06-10 — Strategic pivot + Claude Code native integration (A+B+C)
|
|
6
|
+
|
|
7
|
+
### Added (Claude Code integration — A + B + C from the rebrand backlog)
|
|
8
|
+
- **`opscontext install-skill [--global | --project] [--force]`** — copies the bundled OpsContext skill into Claude Code's skills directory (`~/.claude/skills/opscontext/` global or `<cwd>/.claude/skills/opscontext/` project). Claude Code surfaces it via native skills loading; no MCP roundtrip needed for the skill metadata itself. Default scope: project if `<cwd>/.claude/` exists, else global. Refuses to overwrite without `--force`.
|
|
9
|
+
- **`opscontext sync-claude-md [--path FILE] [--dry-run]`** — maintains an idempotent managed block in CLAUDE.md with the OpsContext snapshot: top 5 project learnings (with IDs + categories) + active policy summary (counts per section + first 5 secret-pattern IDs) + last 3 `hook.block` events from the audit log. The block is delimited by canonical `<!-- BEGIN: managed by OpsContext (...) -->` / `<!-- END: managed by OpsContext -->` markers — repeated runs replace the block in place without disturbing surrounding content. **Killer feature**: Claude Code loads CLAUDE.md natively at every session start, so the snapshot reaches the agent's context with zero MCP calls.
|
|
10
|
+
- **Claude Code auto-memory discovery** — `loadSources()` now indexes every `~/.claude/projects/*/memory/*.md` file as a knowledge source. `search_context` finds anything the user told Claude Code to remember; cross-project lookup just works. Opt out via `OPSCONTEXT_SKIP_CLAUDE_MEMORY=1` env var (used by the test suite + air-gapped runs where `~/.claude/` is unreadable).
|
|
11
|
+
- **`src/claude-integration.ts`** (LOCK `[CLAUDE-INTEGRATION]`) — the canonical home for all three. Locked at the managed-block marker format and at the redaction contract (no sensitive payload content ever rendered into CLAUDE.md, since CLAUDE.md is committed to git).
|
|
12
|
+
- **23 new tests** in `tests/claude-integration.test.ts` covering all three:
|
|
13
|
+
- `installSkill`: bundled-missing rejection, fresh install, already-installed reporting, `--force` overwrite, `locateBundledSkill` path walking.
|
|
14
|
+
- `buildManagedBlock`: marker wrapping, project name, learning list with ID+category, long-rule truncation, policy summary with all four section counts, no-policy hint, recent-blocks date prefix.
|
|
15
|
+
- `syncClaudeMd`: creates-when-missing, appends-when-no-markers, replaces-in-place, **true idempotency** (two consecutive runs produce byte-identical output, including the trailing-newline convention).
|
|
16
|
+
- `discoverClaudeMemory`: empty-when-absent, multi-project discovery, .md-only filter, skip-no-memory-subdir.
|
|
17
|
+
- `decodeClaudeProjectSlug`: leading-hyphen → slash, non-prefixed pass-through.
|
|
18
|
+
- **Dogfooded**: this commit ran `node dist/cli.js install-skill --project --force` (installing the skill into `.claude/skills/opscontext/`) and `node dist/cli.js sync-claude-md` (appending the OpsContext snapshot to CE's existing CLAUDE.md without disturbing the top-of-file content).
|
|
19
|
+
|
|
20
|
+
### Renamed
|
|
21
|
+
- **`skills/contextengine/` → `skills/opscontext/`** (with `git mv` for clean history). Frontmatter `name:` updated to `opscontext`, `homepage:` updated to the new npm URL, description reframed to lead with "ops + compliance layer Claude Code can't grow natively". The skill content body still mentions ContextEngine in places — copy refresh is a content-marketing pass, not a code fix.
|
|
22
|
+
|
|
23
|
+
## [2.0.0] — 2026-06-10 — Strategic pivot to "OpsContext for AI Agents"
|
|
24
|
+
|
|
25
|
+
**This is a positioning + package-name change. All features carry forward unchanged. No code behavior changes.**
|
|
26
|
+
|
|
27
|
+
> **Publish status: pending.** Same npm-token blocker as 1.24.0 — token needs to be reissued with publish scope. Once unblocked, publish under the new name as the 2.0.0 release. The old `@compr/contextengine-mcp@1.x.y` line should be `npm deprecate`'d with a one-line pointer at the new package.
|
|
28
|
+
|
|
29
|
+
### Renamed
|
|
30
|
+
- **npm package**: `@compr/contextengine-mcp` → `@compr/opscontext-mcp`. Description updated to reflect ops + compliance positioning. Keywords reordered to lead with `claude-code`, `audit-log`, `compliance`, `soc2`, `iso27001`, `policy-as-code` instead of the generic context/RAG vocabulary.
|
|
31
|
+
- **bin entries**: primary binary is `opscontext`; aliases `opscontext-mcp`, `contextengine`, `contextengine-mcp` ship too so existing `.vscode/mcp.json` configs pointing at the old binary names keep working.
|
|
32
|
+
|
|
33
|
+
### Repositioned (no code change)
|
|
34
|
+
- **README headline** rewritten: "OpsContext for AI Agents — the ops + compliance layer Claude Code can't grow natively." The "Why" section now leads with the honest gap (Claude Code reads your code; it cannot see what's running on your servers). All `npx @compr/contextengine-mcp` install commands updated to `@compr/opscontext-mcp`. A migration note at the top of README links the old name.
|
|
35
|
+
- **MARKETING.md** header rewritten with the new positioning + the "ContextEngine 1.x → OpsContext 2.0" migration story called out as part of the launch narrative. Install commands swapped. **Reddit post copy not yet rewritten** — those posts framed v1 around "persistent memory + Protocol Firewall"; rewriting the copy for the v2 launch is content-marketing work that benefits from a human voice pass.
|
|
36
|
+
|
|
37
|
+
### Deliberately NOT changed (scope discipline — preserves user data)
|
|
38
|
+
- **Storage paths** stay at `~/.contextengine/` — existing users' learnings, sessions, audit log, embedding cache, license remain accessible without migration.
|
|
39
|
+
- **`.contextengine/policy.json` repo path** stays — repos that already authored a policy.json under the contextengine name keep working.
|
|
40
|
+
- **`CONTEXTENGINE_HOME` env var** stays — migration to a new env var name is a separate follow-up commit with proper deprecation period.
|
|
41
|
+
- **`contextengine.json` config name** stays — same reasoning.
|
|
42
|
+
- **TypeScript code identifiers, class names, module names** stay — the rename is external identity only. Internal naming refactor is a separate commit.
|
|
43
|
+
|
|
44
|
+
### Migration story for users (what to put in npm deprecation notice + README)
|
|
45
|
+
- `npm install @compr/opscontext-mcp` is the new install. The 2.0.0 line is functionally identical to 1.24.0 — only the package name and headline change.
|
|
46
|
+
- For automated installs (CI configs, MCP client configs), update `@compr/contextengine-mcp` → `@compr/opscontext-mcp` everywhere.
|
|
47
|
+
- The bin aliases mean the old `contextengine` / `contextengine-mcp` commands still work if you already have them in scripts.
|
|
48
|
+
- Storage paths and policy locations are unchanged, so no data migration is needed.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## [1.24.0] — 2026-06-10 — P0 hygiene + audit log + quick wins + policy foundation + hook migration
|
|
53
|
+
|
|
54
|
+
> **Publish status: pending.** `npm publish` is currently blocked — the granular token `ContextEngine-Publish-GranularApr2026` returns a 404 PUT (npm's misleading code for "this token lacks publish permission on @compr/contextengine-mcp"). To unblock: log into npmjs.com → Settings → Access Tokens → reissue a granular token with **publish** scope on `@compr/contextengine-mcp`, update `~/.npmrc` + `.copilot-credentials.md` + `.npm-token-meta.json`, then `npm publish --access public`. All code in this release is ready; only the registry push is blocked.
|
|
55
|
+
|
|
56
|
+
**The pre-pivot release.** Last meaningful release under the `@compr/contextengine-mcp` name; the next major release will ship under the `@compr/opscontext-mcp` name as part of the strategic pivot to "OpsContext for AI Agents" (the ops/compliance layer Claude Code can't grow natively). All features in this release carry forward — only the package name and headline positioning change.
|
|
57
|
+
|
|
58
|
+
Highlights, in dependency order:
|
|
59
|
+
|
|
60
|
+
### Added (Ed25519 license signature — P0 #3 part 2)
|
|
61
|
+
- **`src/license-sig.ts`** (LOCK `[LICENSE-SIG]`) — Ed25519 verifier on the client. Embeds the production public key (fingerprint `12d0c34c917a47fbed99945d2b7fb439`); self-hosters override via `CE_LICENSE_PUBLIC_KEY` env var.
|
|
62
|
+
- **`server/src/license-sig.ts`** (LOCK `[LICENSE-SIG-SERVER]`) — Ed25519 signer on the server. Loads private key from `ED25519_PRIVATE_KEY_PEM` env, `ED25519_PRIVATE_KEY_PATH` env, or `server/.secrets/ed25519-license-private.pem` (default dev path, gitignored). **Refuses to start if the key is missing** — never silently degrades to no-signature mode.
|
|
63
|
+
- **`src/activation.ts` `loadLicense()`** — now calls `verifyLicenseSignature()`. Three outcomes:
|
|
64
|
+
- `ed25519` → cryptographically verified, full trust.
|
|
65
|
+
- `legacy-grandfathered` → pre-Ed25519 SHA-256 hash; allowed with a one-line warning so existing licensees don't lose access immediately. Audit event `activation.legacy_signature` recorded.
|
|
66
|
+
- reject → forged / tampered / wrong keypair / missing. License rejected, `activation.signature_reject` audit event recorded with reason.
|
|
67
|
+
- **`server/src/server.ts`** — the activate handler now signs the canonical license payload with Ed25519 instead of an HMAC-shaped SHA-256 hash. Signature shape changes from 64-char hex to 88-char base64; the client distinguishes the two.
|
|
68
|
+
- **Canonical payload is byte-pinned** — `canonicalPayload()` is duplicated identically in both `src/license-sig.ts` and `server/src/license-sig.ts`. A test on each side asserts a known-input → known-output reference string to catch drift. Without this pin, any drift breaks every license issued after the divergence.
|
|
69
|
+
- **14 new license-sig tests** (`tests/license-sig.test.ts`) — canonical payload reference + key-order independence; public-key constant shape + fingerprint; verify ok / wrong-keypair-rejection / payload-tampering / empty-signature / garbage-signature / legacy-grandfathering / env-var override for self-hosters; plus **three adversarial "audit attack" tests** pinning the exact privilege-escalation scenarios the audit named — forged enterprise license without signature, guessed-zero signature, plan field rewritten after signing.
|
|
70
|
+
- **End-to-end roundtrip verified** with the actual production keypair: production private signs a payload, production public verifies, tampering with the `plan` field correctly fails verification.
|
|
71
|
+
- **`docs/deploy/ED25519_MIGRATION.md`** — full deploy runbook: pre-deploy checklist, private-key transfer, server deploy, live verification, rollback plan, flag-day plan for retiring legacy-signature acceptance.
|
|
72
|
+
|
|
73
|
+
**Status**: Server code, client code, tests, and migration doc all merged to `main`. **Production server NOT yet deployed.** Awaiting explicit authorization to deploy to `api.compr.ch` per the runbook in `docs/deploy/ED25519_MIGRATION.md`. Existing customers are unaffected until the server is updated; after the server deploys, new activations will be Ed25519-signed and existing pre-Ed25519 licenses will continue to work via the grandfather path until the documented flag day.
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
### Changed (hook migration — P1 #4 part 3)
|
|
78
|
+
- **`hooks/pre-commit`** now invokes the TypeScript policy-driven checkers from part 2 when both a CLI and a `.contextengine/policy.json` are present in the repo. Additive integration — gitleaks + policy scan + inline 17 CE patterns all run as complementary layers, first-to-block wins. For doc coverage, the policy-driven check is **authoritative** when a policy exists; the legacy 4-hour wall-clock check is suppressed (it was the workaround pattern that taught `touch SKILLS.md SCORE.md` as the rational answer).
|
|
79
|
+
- **`find_ce_cli()` helper** locates the CLI via `node_modules/.bin/contextengine` (project-local install, preferred) → `command -v contextengine` (global / npm-link). Does NOT fall back to `npx @compr/contextengine-mcp` — cold npx on every commit is ~2-3 s, too expensive for the hot path. Teams that want policy enforcement install CE in node_modules.
|
|
80
|
+
- **Repos without `.contextengine/policy.json` keep the legacy path unchanged** — same 17 inline patterns, same 4-hour wall-clock check. Migration is opt-in by authoring a policy file.
|
|
81
|
+
- **Legacy error banner gains a one-line migration nudge**: "💡 Author `.contextengine/policy.json` for diff-aware coverage instead of wall-clock staleness." Documents the upgrade path without forcing it.
|
|
82
|
+
- **End-to-end smoke-tested three scenarios** in ephemeral repos:
|
|
83
|
+
1. No policy + missing CE docs → legacy 4 h gate blocks. ✓
|
|
84
|
+
2. Policy + JWT-shape token in `docs/sessions/SESSION_99.md` → policy-driven secret-scan blocks (`[block] jwt_in_session_doc at docs/sessions/SESSION_99.md:1`), pattern correctly scoped only to `docs/sessions/**/*.md`. ✓
|
|
85
|
+
3. Policy + clean code → both policy layers print `✅` and commit proceeds. ✓
|
|
86
|
+
- **Dogfooded**: `cp hooks/pre-commit .git/hooks/pre-commit` in CE itself; this very commit travels through the new hook end-to-end.
|
|
87
|
+
|
|
88
|
+
### Added (hook checkers — P1 #4 part 2)
|
|
89
|
+
- **`src/hooks.ts`** — TypeScript implementations of the policy-driven gates. Exports `getStagedFiles()` (parses `git diff --cached --unified=0` into structured `{path, addedLines:[{lineNumber, content}]}` records), `runSecretScan(policy, files)` (applies `policy.secret_patterns` with `paths` glob scoping), `runDocCoverage(policy, files, repoRoot)` (diff-aware doc-section coverage), plus a tiny in-house `globToRegExp()` and `hashDocSection()` foundation for the next-iteration anchor-hash check.
|
|
90
|
+
- **CLI `contextengine hook <secret-scan|doc-coverage>`** — reads `.contextengine/policy.json` from `git rev-parse --show-toplevel`, applies the relevant checker, exits 0 (clean) or 1 (blocking violations found). `CE_JSON=1` switches to one-line JSON for CI logs. No policy file → no-op (exit 0).
|
|
91
|
+
- **`hook.block` audit events** — every blocking violation appends a record to the tamper-evident audit log. Field shape differs per check (secret-scan: pattern_id + file + line; doc-coverage: source_paths + matched_files + requires_section + reason).
|
|
92
|
+
- **Redaction contract**: `SecretViolation` records carry the pattern id + file + line only. The matched secret value is NEVER serialized into the violation object, the human-readable output, or the JSON output. Verified by a test that grep-checks the serialized output for the matched substring.
|
|
93
|
+
- **25 hook tests** (`tests/hooks.test.ts`) — `globToRegExp` exact matching, `**` directory recursion, `?` single-char, regex meta escaping, anchoring; `runSecretScan` global + scoped patterns + line number reporting + the redaction-contract test; `runDocCoverage` for all four reasons (no rule fires, doc missing, doc staged → pass, doc unstaged → block, multi-rule collection); `hashDocSection` with anchor matching + mutation detection + missing anchor; formatter clean-state lines + JSON parseability; live `getStagedFiles` against an ephemeral git repo built with `mkdtempSync`.
|
|
94
|
+
- **LOCK [HOOK-CHECKERS]** block on `src/hooks.ts` — protects the redaction contract and the loud-failure-over-silent-skip principle.
|
|
95
|
+
|
|
96
|
+
**Smoke-tested end-to-end against CE's own policy** in an ephemeral repo: stage `docs/sessions/SESSION_99.md` with a JWT-shape token → `hook secret-scan` exits 1 with `[block] jwt_in_session_doc at docs/sessions/SESSION_99.md:1` (pattern scoped only to `docs/sessions/**`); stage `src/firewall.ts` without `SKILLS.md` → `hook doc-coverage` exits 1 with "doc file does not exist"; stage `SKILLS.md` alongside → both exit 0.
|
|
97
|
+
|
|
98
|
+
**Not in this commit** (next sprint): replacing the inline secret patterns in `hooks/pre-commit` with `contextengine hook secret-scan`. The TypeScript path is shippable + dogfoodable now; the bash hook stays as-is so existing installations keep working unchanged. Migration is a separate, fully-tested step.
|
|
99
|
+
|
|
100
|
+
### Added (policy contract foundation — P1 #4 part 1)
|
|
101
|
+
- **`src/policy.ts`** — declarative policy contract for hooks, CC PreToolUse, and future CI templates to consume. Schema v1 with four sections:
|
|
102
|
+
- `secret_patterns` — id-tagged regex rules (severity `block` | `warn`), optional `paths` glob scoping (e.g. JWT pattern only applied to `docs/sessions/**/*.md` — the Apec-leak shape)
|
|
103
|
+
- `doc_coverage` — source-subtree → doc-section mappings. Replaces the legacy 4-hour wall-clock staleness gate with diff-aware coverage.
|
|
104
|
+
- `deploy_verify_hosts` — production hosts requiring a verification probe within N seconds of `git push`. Encodes `CLAUDE.md` "DEPLOY = VERIFY LIVE".
|
|
105
|
+
- `bypass_tokens` — documented escape hatches with reason + TTL. Beats undocumented `touch foo.md` / `--no-verify` workarounds.
|
|
106
|
+
- **Zod-based validator** — `validatePolicy()` returns either a typed `Policy` or a structured list of `{path, message}` field-level errors. `parsePolicy()` adds the JSON-parse layer.
|
|
107
|
+
- **`loadRepoPolicy(repoRoot)`** — loads `<repo>/.contextengine/policy.json`, returns null when absent (hooks fall back to built-in defaults) or a `ValidationResult` so schema errors surface to the user instead of crashing.
|
|
108
|
+
- **CLI** — `contextengine policy validate <file>` and `contextengine policy show` (loads the active repo policy and pretty-prints all four sections with counts). Validate exit 0/1 for CI use.
|
|
109
|
+
- **`.contextengine/policy.json`** — CE now dogfoods its own policy. Three secret patterns (JWT-in-session-doc, anthropic, openai), four doc-coverage rules (firewall/activation block, audit/policy warn until SKILLS sections are written), one deploy-verify host (`api.compr.ch`), one bypass token (`emergency_hotfix` with 30-char reason minimum).
|
|
110
|
+
- **18 policy tests** (`tests/policy.test.ts`) — minimal-valid + fully-populated acceptance, default severity, default `within_seconds`, version/missing-field rejection, malformed JSON graceful failure, disk integration with `mkdtempSync` isolation, summary formatter.
|
|
111
|
+
- **LOCK [POLICY-CONTRACT]** block at top of `src/policy.ts` — version bumps and required-field additions both require migration paths.
|
|
112
|
+
|
|
113
|
+
**Status**: Schema + loader + validator + CLI ship in this release. **Hook integration (actually consuming the policy from pre-commit / CC hooks / CI templates) is the next sprint** — this release lets teams author + validate + review policies in PR ahead of the wiring.
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
### Added (quick-wins pass — P0 #4)
|
|
118
|
+
- **`contextengine export-learnings`** CLI — `--project NAME [--category CAT] [--format json|markdown] [--include-universal]`. Filters a project's learnings into a self-contained export. Without `--project`, output carries an explicit "ALL projects (warning: cross-project IP)" banner so the user can't accidentally share a consultant's full cross-client store. Closes the consultant/contractor confidentiality gap from the audit.
|
|
119
|
+
- **`gitleaks` wrapper** in `hooks/pre-commit` — if the `gitleaks` binary is on `$PATH`, the hook runs `gitleaks protect --staged --redact --no-banner --verbose` first (`~150` industry-standard patterns: Azure, GCP, OpenAI, Anthropic, JWT, SSH keys, npm tokens, etc.). CE's 17 in-house patterns + project-specific shapes (`Cr0wlr_Pr0d_`, `C0ldEm@il_`) and the `.copilot-credentials.md` guard still run after. Two-layer defense; the two are complementary, not redundant. End-to-end tested both branches: gitleaks present → blocks with gitleaks banner; absent → falls through to CE patterns (existing behavior preserved).
|
|
120
|
+
- **3 CLI tests** for `export-learnings`: `--help` carries the cross-client warning; `--project <nonexistent>` returns valid empty JSON with the right scope envelope; markdown export without `--project` carries the ALL-projects warning header.
|
|
121
|
+
|
|
122
|
+
### Changed (quick-wins pass — P0 #4)
|
|
123
|
+
- **`@huggingface/transformers` moved to `optionalDependencies`**. Cold install drops by ~427 MB (134 MB transformers + 201 MB onnxruntime-node + 91 MB onnxruntime-web + 1 MB onnxruntime-common). Locked-down npm proxies, air-gapped CI, and free-tier GitHub Actions runners no longer fail at install. BM25 keyword search ships always and is sufficient for most workspaces.
|
|
124
|
+
- When the dep is absent at runtime, `initEmbeddings()` emits an actionable one-shot message pointing to `npm install @huggingface/transformers` and the MCP server keeps serving keyword-only search.
|
|
125
|
+
- Verified end-to-end in a sandboxed install with `--omit=optional`: `npm install` succeeds without HF, MCP server boots cleanly, fallback message renders, BM25 search returns results.
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
### Added (audit log workstream — P0 #3, part 1 of 2)
|
|
130
|
+
- **`src/audit.ts`** — hash-chained JSONL audit log at `~/.contextengine/audit.log`. Every state-changing operation appends one canonically-serialized record with `{ts, event, actor, payload, prev_hash, hash}`. The chain is rooted at a 64-zero genesis hash; each record's hash covers the canonical bytes of itself plus its `prev_hash`, so any historical mutation breaks chain verification at the mutated index.
|
|
131
|
+
- Compliance basis: SOC2 CC7.2 (audit logging), ISO 27001 A.12.4.1 (event logs).
|
|
132
|
+
- Privacy: records carry **metadata only** — IDs, categories, projects, lengths. Never the rule text, session value content, or license signature.
|
|
133
|
+
- `safeAppend()` wrapper isolates audit failures from production hot paths (failed appends log to stderr only — they cannot break a learning save or session write).
|
|
134
|
+
- Paths injectable via `CONTEXTENGINE_HOME` env var so tests run against `mkdtempSync` without touching real `~/.contextengine`.
|
|
135
|
+
- **Wired into** `saveLearning`, `deleteLearning`, `importLearningsFromFile` (+ per-entry events from the inner save loop), `saveSession`, `deleteSession`, `activate`, `deactivate`. Aggregate `learning.import` event correlates the batch with its individual `learning.save` records.
|
|
136
|
+
- **`audit_verify` MCP tool** — agents can self-check the chain (returns OK + count, or BROKEN + break index + reason).
|
|
137
|
+
- **CLI commands** — `contextengine audit-export [--since DATE] [--until DATE] [--format jsonl|csv]` and `contextengine audit-verify` (exit code 2 on broken chain so CI/cron can monitor).
|
|
138
|
+
- **19 audit tests** (`tests/audit.test.ts`) — append/genesis hash, multi-record chain linking, payload tampering detection, prev_hash splicing detection, appended-forgery detection, graceful failure on corrupt JSON, range filtering, RFC 4180 CSV escaping. All tests run in isolated `tmpdir()` directories.
|
|
139
|
+
|
|
140
|
+
### Added (P0 hygiene pass)
|
|
141
|
+
- **`delete_session` MCP tool** — registered in `src/index.ts` (was exported but never wired). README claimed 19 tools while only 18 were registered; the tool table is now truthful (20 with `audit_verify`).
|
|
142
|
+
- **`delete-session` CLI command** — `npx @compr/contextengine-mcp delete-session <name>`.
|
|
143
|
+
|
|
144
|
+
### Changed
|
|
145
|
+
- **`src/activation.ts` docstring + `PREMIUM_MODULES`** — removed `"collectors"` from the premium-module list. Reality: operational collectors run during reindex for all users (data feeds `search_context` for everyone). PRO gates only the four tools that consume that data (`list_projects`, `check_ports`, `run_audit`, `score_project`). Docstring + COMPETITIVE_ANALYSIS/MARKETING claims now match the code path.
|
|
146
|
+
- **MARKETING.md Reddit Post #5** — rewritten to list the actual 19 tools. Dropped 5 fictitious tools (`register_project`, `get_project_context`, `configure_adapter`, `get_skill`, `list_skills`) that were never implemented.
|
|
147
|
+
- **`.github/copilot-instructions.md`** — replaced inflated "1,233 weekly downloads" claim with the live npm registry value (95/week as of 2026-06).
|
|
148
|
+
- **Hook error banners** (`hooks/pre-commit`, `hooks/pre-commit-secrets`) — removed `Override: git commit --no-verify` line. Hooks should not advertise their bypass.
|
|
149
|
+
|
|
150
|
+
### Removed
|
|
151
|
+
- **Obfuscation pipeline** — `scripts/obfuscate-firewall.mjs`, the `terser` devDependency, and the `&& node scripts/obfuscate-firewall.mjs` build step. The shipped sourcemaps defeated the obfuscation (`firewall.js.map` mapped straight back to `../src/firewall.ts`). BSL-1.1 provides the legal protection layer; obfuscation theater was a build-complexity tax for zero security benefit.
|
|
152
|
+
- **Sourcemaps from npm tarball** — added `!dist/**/*.map` to `package.json` `files[]` and `dist/**/*.map` to `.npmignore`. Drops ~50% of published tarball bytes.
|
|
153
|
+
- **Stale artifacts**:
|
|
154
|
+
- `src/test.ts` — orphaned dev harness (had previously leaked once in v1.17).
|
|
155
|
+
- `dist/test.{js,d.ts}`, `dist/test-sessions.d.ts` — build leftovers.
|
|
156
|
+
- `score-report.html` — tracked snapshot at a path the code does not write.
|
|
157
|
+
- `hooks/post-commit` — 0-byte file (claimed gdrive auto-push but was empty).
|
|
158
|
+
- `VSCODE_EXTENSION_STEPS.md` — done-status runbook from Feb 2026.
|
|
159
|
+
|
|
160
|
+
### Notes
|
|
161
|
+
- **Audit log = part 1 of P0 #3**. Part 2 (activation `LicenseInfo.signature` Ed25519 verification in `loadLicense()`) is the security/revenue leak fix and remains a separate workstream — requires keypair generation, server-side issuance, and migration of existing licenses.
|
|
162
|
+
- **README tool count is now 20** (added `audit_verify`). MARKETING Reddit Post #5 should be re-synced in the next hygiene sweep.
|
|
163
|
+
|
|
164
|
+
## [1.23.1] — 2026-04-18
|
|
165
|
+
|
|
166
|
+
### Changed
|
|
167
|
+
- **`end_session` skill doc** — `skills/contextengine/SKILL.md` now documents both invocation paths: MCP tool (primary) and CLI fallback `npx @compr/contextengine-mcp end-session` (for Cursor, Copilot, and terminal sessions where MCP is not connected). Matches the Rule 13 pattern already used for `save_learning`.
|
|
168
|
+
- Removed hardening prose from post-commit verification section — rule is now actionable in any environment.
|
|
169
|
+
|
|
170
|
+
## [1.23.0] — 2026-03-17
|
|
171
|
+
|
|
172
|
+
### Added
|
|
173
|
+
- **Content-validated scoring** — `.env.example` now checks for 3+ real env var declarations (not just file existence). `.gitignore` validates essential patterns (.env, node_modules, dist). CI/CD workflows verified for real `run:`/`uses:` actions (empty stubs get partial credit). Directly addresses "you can score A+ with phantom env vars" feedback.
|
|
174
|
+
- **"What ContextEngine is NOT" section** in README — honest positioning: not a code quality tool, not required daily, not worth chasing 100%.
|
|
175
|
+
|
|
176
|
+
### Changed
|
|
177
|
+
- **README tagline** — "Persistent memory and mechanical enforcement for AI coding agents" (was "The context layer between your codebase and your AI agent").
|
|
178
|
+
- **Why section rewritten** — leads with the 3 proven value layers: persistent memory, mechanical enforcement, structural checklist.
|
|
179
|
+
- **Tools table** — 17 → 19 tools (added `delete_session`, `activation_status`).
|
|
180
|
+
- **SKILLS.md** — tool count 17→19, command count 15→16.
|
|
181
|
+
|
|
182
|
+
## [1.22.0–1.22.1] — 2026-03-03
|
|
183
|
+
|
|
184
|
+
### Fixed
|
|
185
|
+
- **A-to-Z audit fixes (12 bugs)** — `generateMcpJson()` broken args, hardcoded versions, `activeProjectNames` never set, `estimateTimeSaved()` inflation, `delete_learning` not registered as tool, `firewall.setProjectDirs()` skipped, `autoImportFromSources()` not called at startup, redundant `loadProjectDirs()` calls, dead `accepted` variable, SKILL.md tool count, license inconsistency (AGPL→BSL-1.1).
|
|
186
|
+
- **10-min session save timer** — commit/push reminder with 5 tests.
|
|
187
|
+
|
|
188
|
+
## [1.20.2] — 2026-02-26
|
|
189
|
+
|
|
190
|
+
### Fixed
|
|
191
|
+
- **MCP config schema** — `.vscode/mcp.json` corrected from `mcpServers` to `servers`, added `"type": "stdio"`. MCP was disconnected from Copilot Chat without this fix.
|
|
192
|
+
- Removed deprecated MCP config from `.code-workspace` settings.
|
|
193
|
+
- **Multi-window output.log** — `outputLogger.ts` now tags every line with workspace name (e.g. `[ContextE]`, `[compR]`) to disambiguate shared log from multiple VS Code windows.
|
|
194
|
+
|
|
195
|
+
### Added
|
|
196
|
+
- 3 new test suites: `cli.test.ts` (8 tests), `sessions.test.ts` (16 tests), `firewall.test.ts` (8 tests).
|
|
197
|
+
- **57 tests across 6 files** (was 25 in 3 files). Score: 95% A+.
|
|
198
|
+
- PM2 `ecosystem.config.cjs` for local dev orchestration.
|
|
199
|
+
|
|
200
|
+
## [1.20.1] — 2026-02-25
|
|
201
|
+
|
|
202
|
+
### Fixed
|
|
203
|
+
- **Pre-commit hook now BLOCKS** (exit 1) — agents ignore warnings, only hard gates prevent compliance drift.
|
|
204
|
+
|
|
205
|
+
### VS Code Extension v0.6.2–v0.6.7
|
|
206
|
+
- Terminal watcher — 9 categories, 10 credential redaction patterns, stuck-pattern detection (3+ failures).
|
|
207
|
+
- Log dedup (v0.6.5) — fingerprint-based, 99% output noise reduction.
|
|
208
|
+
- Output file logger (v0.6.7) — mirrors Output panel to `~/.contextengine/output.log` for agent analysis.
|
|
209
|
+
- Credential redaction broadened to `WORD_API_KEY=` patterns + vendor prefixes (gsk_, sk-live_, ghp_, etc.).
|
|
210
|
+
|
|
211
|
+
## [1.20.0] — 2026-02-25
|
|
212
|
+
|
|
213
|
+
### Added
|
|
214
|
+
- **Value Meter** — status bar shows recalls, saves, estimated time saved.
|
|
215
|
+
- **Live stats dashboard** — ℹ️ info panel shows real-time session metrics.
|
|
216
|
+
- **CLI `stats` command** — reads `~/.contextengine/session-stats.json` for live metrics.
|
|
217
|
+
- Stats written by Protocol Firewall via `flushStats()` (debounced every 10s).
|
|
218
|
+
|
|
219
|
+
## [1.19.0–1.19.1] — 2026-02-24
|
|
220
|
+
|
|
221
|
+
### Added
|
|
222
|
+
- **Protocol Firewall** — escalating compliance enforcement on all 17 tool responses.
|
|
223
|
+
- **Learning quality gates** — min 15 chars, auto-categorization, import filters.
|
|
224
|
+
- **Auto-import learnings** from discovered markdown sources during reindex.
|
|
225
|
+
- **Delta module obfuscation** — terser mangle+compress, 46–72% size reduction.
|
|
226
|
+
- Privacy & Data Security section in README.
|
|
227
|
+
- GitHub repo made PUBLIC.
|
|
228
|
+
|
|
229
|
+
## [1.18.0] — 2026-02-23
|
|
230
|
+
|
|
231
|
+
### Security
|
|
232
|
+
- **Project-scoped learnings** — `listLearnings()` and `learningsToChunks()` now accept `projects[]` param. Only returns learnings matching active workspace project names + universal (no project set). Prevents cross-project IP leakage.
|
|
233
|
+
- MCP: `activeProjectNames` state populated from `loadProjectDirs()` during reindex, passed to all learnings calls.
|
|
234
|
+
- CLI: `cliListLearnings()` and `initEngine()` scope by project via `loadProjectDirs()`.
|
|
235
|
+
|
|
236
|
+
### Improved
|
|
237
|
+
- **`end-session` CLI** — comprehensive pre-flight with 4 sections: (1) git status with branch names, (2) doc freshness (copilot-instructions, SKILLS.md, SCORE.md), (3) learnings stats (total, categories, scoped vs hidden), (4) sessions (count, 3 most recent with age).
|
|
238
|
+
|
|
239
|
+
### VS Code Extension v0.4.0
|
|
240
|
+
- **`/sync` chat command** — checks CE doc freshness per project, shows stale/missing docs with actionable steps.
|
|
241
|
+
- **`contextengine.sync` command** — Output channel report with "Open Chat" action.
|
|
242
|
+
- **Doc staleness notifications** — fires warning when code committed but CE docs not updated (15-min cooldown).
|
|
243
|
+
- **Pre-commit hook** — `hooks/pre-commit` warns about stale CE docs when code files are staged (never blocks).
|
|
244
|
+
- **CE doc freshness in GitSnapshot** — `checkCEDocFreshness()` tracks copilot-instructions, SKILLS.md, SCORE.md age per project.
|
|
245
|
+
- **Terminal watcher** — monitors command completions via Shell Integration API (`onDidEndTerminalShellExecution`). Classifies commands (git/npm/build/deploy/test/ssh), fires notifications on success/failure, auto-rescans git status after git commands. 30s cooldown per category.
|
|
246
|
+
- Philosophy: **event-driven compliance** (hooks + scan-cycle triggers), not memory-driven.
|
|
247
|
+
|
|
248
|
+
## [1.17.0] — 2026-02-22
|
|
249
|
+
|
|
250
|
+
### Changed
|
|
251
|
+
- **License: AGPL-3.0 → BSL-1.1** — Business Source License with non-compete clause. Converts to AGPL-3.0 on Feb 22, 2030.
|
|
252
|
+
- **README overhaul** — added VS Code Extension section, PRO Features comparison table, pricing CTA, marketplace badge.
|
|
253
|
+
|
|
254
|
+
### Added
|
|
255
|
+
- Pricing page (`server/public/pricing.html`) — dark-themed, responsive, 3-tier cards (Pro $2/Team $12/Enterprise $36).
|
|
256
|
+
- `/contextengine/pricing` route on activation server.
|
|
257
|
+
- Info panel upgrade flow — PRO badges are clickable → pricing page, golden CTA box with plan prices.
|
|
258
|
+
- Pricing page billing toggle (monthly/annual) + JavaScript checkout flow via `/contextengine/create-checkout-session`.
|
|
259
|
+
- Success page (`server/public/success.html`) — post-checkout landing with activation instructions.
|
|
260
|
+
- `/contextengine/success` route on activation server.
|
|
261
|
+
- PM2 ecosystem.config.cjs on VPS with Stripe test key (`stripeEnabled: true`).
|
|
262
|
+
|
|
263
|
+
### Fixed
|
|
264
|
+
- Excluded `test.js` and `test-sessions.js` from npm package (dev artifacts were shipping to users).
|
|
265
|
+
|
|
266
|
+
## [1.16.0] — 2026-02-21
|
|
267
|
+
|
|
268
|
+
### Added
|
|
269
|
+
- **5 new CLI commands**: `save-session`, `load-session`, `list-sessions`, `end-session`, `import-learnings`.
|
|
270
|
+
- Non-interactive mode (`--yes` / `-y` / `!process.stdin.isTTY`).
|
|
271
|
+
- Auto-session inject on MCP startup (loads most recent session <72h).
|
|
272
|
+
- Enforcement nudge: reminds agents to `save_session` after 15+ tool calls.
|
|
273
|
+
- Git status warnings every 2 minutes of tool activity.
|
|
274
|
+
- Context-aware scoring: stub Dockerfiles get minimal credit, managed platforms get full infra points.
|
|
275
|
+
- `import_learnings` MCP tool — bulk-import from Markdown or JSON.
|
|
276
|
+
- `delete_learning` MCP tool.
|
|
277
|
+
|
|
278
|
+
## [1.15.0] — 2026-02-20
|
|
279
|
+
|
|
280
|
+
### Added
|
|
281
|
+
- **Activation / licensing system** — license validation, AES-256-CBC delta decryption, machine fingerprinting, daily heartbeat.
|
|
282
|
+
- **Activation server** (`server/`) — Express + SQLite3 + Helmet, port 8010.
|
|
283
|
+
- **Stripe integration** — checkout sessions, webhook handler, license provisioning, SMTP email delivery.
|
|
284
|
+
- **Delta modules** — premium code extracted and encrypted per-machine.
|
|
285
|
+
- 4 gated PRO tools: `score_project`, `run_audit`, `check_ports`, `list_projects`.
|
|
286
|
+
- Rate limiting (5 req/min), CORS whitelist, graceful shutdown.
|
|
287
|
+
- Machine fingerprint: `SHA-256(platform|arch|homedir|user)`.
|
|
288
|
+
|
|
289
|
+
## [1.14.0] — 2026-02-19
|
|
290
|
+
|
|
291
|
+
### Added
|
|
292
|
+
- **VS Code Extension v0.1.0** — git monitor, status bar, chat participant, notifications.
|
|
293
|
+
- VS Code Extension v0.2.0 — info panel WebView with monitoring checklist.
|
|
294
|
+
- `@contextengine` chat participant with `/status`, `/commit`, `/search`, `/remind` commands.
|
|
295
|
+
- Escalating notification system with cooldown.
|
|
296
|
+
|
|
297
|
+
## [1.0.0–1.13.x]
|
|
298
|
+
|
|
299
|
+
### Core
|
|
300
|
+
- MCP server with stdio transport.
|
|
301
|
+
- BM25 keyword + semantic search (Xenova `all-MiniLM-L6-v2`).
|
|
302
|
+
- Auto-discovery of `copilot-instructions.md`, `CLAUDE.md`, `.cursorrules`, `AGENTS.md`.
|
|
303
|
+
- Code parsing (TS/JS/Python function/class extraction).
|
|
304
|
+
- Operational collectors: git, Docker, PM2, nginx, cron, package.json.
|
|
305
|
+
- Session persistence (`save_session`, `load_session`, `list_sessions`).
|
|
306
|
+
- Learnings store (append-only, category-validated, dedup).
|
|
307
|
+
- Plugin adapters (Notion, RSS, custom).
|
|
308
|
+
- CLI with 15 subcommands.
|
|
309
|
+
- AI-readiness scoring (12 checks, weighted rubric, A+ to F).
|
|
310
|
+
- Compliance audit (security, performance, DX, architecture).
|
|
311
|
+
- Port conflict detection across projects.
|
|
312
|
+
- 25 vitest tests.
|
|
313
|
+
- GitHub Actions CI (Node 18/20/22).
|
package/LICENSE
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
Parameters
|
|
4
|
+
|
|
5
|
+
Licensor: FASTPROD (PROD LLC)
|
|
6
|
+
Licensed Work: ContextEngine
|
|
7
|
+
The Licensed Work is (c) 2026 FASTPROD (PROD LLC)
|
|
8
|
+
Additional Use Grant: You may use the Licensed Work for any purpose, including
|
|
9
|
+
production use, EXCEPT you may not offer the Licensed Work
|
|
10
|
+
or any derivative work as a hosted or managed service that
|
|
11
|
+
competes with the Licensor's paid offerings (ContextEngine
|
|
12
|
+
PRO, Team, and Enterprise plans).
|
|
13
|
+
Change Date: February 22, 2030
|
|
14
|
+
Change License: GNU Affero General Public License v3.0
|
|
15
|
+
|
|
16
|
+
For information about alternative licensing arrangements for the Licensed Work,
|
|
17
|
+
please contact: yannick@compr.ch
|
|
18
|
+
|
|
19
|
+
Notice
|
|
20
|
+
|
|
21
|
+
The Business Source License (this document, or the "License") is not an Open
|
|
22
|
+
Source license. However, the Licensed Work will eventually be made available
|
|
23
|
+
under an Open Source License, as stated in this License.
|
|
24
|
+
|
|
25
|
+
License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
|
|
26
|
+
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
|
27
|
+
|
|
28
|
+
-----------------------------------------------------------------------------
|
|
29
|
+
|
|
30
|
+
Terms
|
|
31
|
+
|
|
32
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
33
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
34
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
35
|
+
production use.
|
|
36
|
+
|
|
37
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
38
|
+
available distribution of a specific version of the Licensed Work under this
|
|
39
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
40
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
41
|
+
above terminate.
|
|
42
|
+
|
|
43
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
44
|
+
currently in effect as described in this License, you must purchase a
|
|
45
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
46
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
47
|
+
|
|
48
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
49
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
50
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
51
|
+
for each version of the Licensed Work released by Licensor.
|
|
52
|
+
|
|
53
|
+
You must conspicuously display this License on each original or modified copy
|
|
54
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
55
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
56
|
+
License apply to your use of that work.
|
|
57
|
+
|
|
58
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
59
|
+
terminate your rights under this License for the current and all other
|
|
60
|
+
versions of the Licensed Work.
|
|
61
|
+
|
|
62
|
+
This License does not grant you any right in any trademark or logo of
|
|
63
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
64
|
+
Licensor as expressly required by this License).
|
|
65
|
+
|
|
66
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
67
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
68
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
69
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
70
|
+
TITLE.
|
|
71
|
+
|
|
72
|
+
MariaDB hereby grants you permission to use this License's text to license
|
|
73
|
+
your works, and to refer to it using the trademark "Business Source License",
|
|
74
|
+
as long as you comply with the Coattails Provision below.
|
|
75
|
+
|
|
76
|
+
Coattails Provision
|
|
77
|
+
|
|
78
|
+
If you are a Licensor under this License, you may not remove or modify this
|
|
79
|
+
section.
|
|
80
|
+
|
|
81
|
+
If your use of this License is in connection with a for-profit entity or
|
|
82
|
+
endeavor, the Licensor must make the Licensed Work available under an Open
|
|
83
|
+
Source Initiative-approved license no later than the Change Date.
|