Repository navigation
cogos-harness 0.4.0: mods skeleton (5 mods, shared lib) + retire dead hooks - #29
Open
chazmaniandinkle wants to merge 1 commit into
Open
chazmaniandinkle wants to merge 1 commit into
chazmaniandinkle wants to merge 1 commit into
Conversation
…d lib One function-hooks module (hooks/index.mjs) composes five mods: cog-redact, cog-guard, cog-context, cog-status and cog-receipt. In this release each mod loads, registers, and passes every event through unchanged. Every mod is off unless ~/.cog/conf/harness-mods.json enables it; a missing file means all off. hooks.json keeps every existing shell hook alongside "modules". Shared lib/: cfg (off/shadow/on loader), order (typed redact->guard->context-> status->receipt), cache (vitals read/write with age, stale > 2 min shown), ledger (hook-health rows, append-only), kernel (fetch with X-Cogos-Grant), stub (the no-op body). Layout follows engine rules measured with claude plugin validate (2.1.292): - one hooks module per plugin; - a matcher on any repeated event; - $ never crosses an import, so lib/ takes an io adapter built per mod. Tests: one per mod (off/missing/shadow), order.test.ts on the real chain (negative-controlled: swapping redact/guard fails it), lib.test.ts. Vendored 2.1.292 types make tsc runnable. Actor: agent Session-ID: 20261006_155913_669258 Instance: darkstar Harness: hermes/cog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mods program, step 2: the shared skeleton the five mod builds branch from (
feat/mod-<name>off this branch). Plan:cog://mem/semantic/plans/harness-mods-program§2–§4.What lands
"types": "./types/index.d.ts".hooks/index.mjs: the plugin's one hooks module. It callsregister(on, options)for redact → guard → context → status → receipt.mods/cog-{redact,guard,context,status,receipt}.mjs: stubs that register their briefed events and pass every event through unchanged.lib/:cfg.mjs:~/.cog/conf/harness-mods.json, modes off/shadow/on. A missing or malformed file means every mod is off.order.mjs: the typed order,before().cache.mjs: vitals read/write with age. Anything older than 2 min shows its age. Mirrored to~/.cog/run/vitals.json.ledger.mjs: hook-health rowsmod/<name>/<event>, append-only.kernel.mjs: fetch withX-Cogos-Grant.stub.mjstypes/index.d.ts: thePluginStatecontract, one block per mod.types/vendor/: Claude Code's own 2.1.292 mod types, sotscruns in a fresh clone.hooks.jsoncarries both"hooks"and"modules".Behaviour
harness-mods.json(default)next(e)after one cached config read; no ledger rows, no writes (tested)shadowshadow:true, would:"none"ledger row per run; the event is unchangedtool.callorderEngine rules found with
claude plugin validate(2.1.292)These shaped the layout, and the README documents them for the mod agents:
index.mjs.{}.$is followed only into functions declared in the same file, never across an import. Solib/takes anioadapter that each mod builds with its own same-fileioOf($). The base keys are identical in all five.Verification (real output, from repo root)
Negative controls:
redact/guardinindex.mjsfailsorder.test.ts(2 fail).before()failstsc(TS2345).order.test.tshas one PENDING-CONTRACT case: the fake key plus attribution line is denied, and the deny text holds the placeholder. Over the stubs it asserts only the pass-through baseline; the redact and guard PRs make it real.Retire-now
None of the 7 RETIRE rows (#10's file, 40, 44, 54, 56, 60, 67) is in this repo. All of them are in the cog workspace's
.cog/hooks/, so this PR has no retire commit.Do not merge until reviewed.