From 21c686bd65965409e65976c3854796049d6847ad Mon Sep 17 00:00:00 2001 From: Jean Machuca Date: Sat, 4 Jul 2026 23:26:55 -0400 Subject: [PATCH 1/3] feat: add Phase 8 for autonomous package management to implementation plan (#35) --- plan/implementation-plan.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/plan/implementation-plan.md b/plan/implementation-plan.md index 5bc84aa..326cb50 100644 --- a/plan/implementation-plan.md +++ b/plan/implementation-plan.md @@ -291,6 +291,36 @@ The registry is a **notary proxy** — it does not host `.cgp` files. Publishers - A1-A10 validation rejects malformed publishes at registry level ✅ - `cpm init my-skill` creates a valid .cgp skeleton ✅ +### Phase 8: Autonomous Package Management + +**Repos:** `core-mcp-bridges`, `cognitiveosd`, `inference`, `product-specs` + +**Goal:** The Wide Model can autonomously discover, install, and remove packages in response to human requests, with every operation validated by the Raw Model. + +| Task | Dependencies | Est. effort | Status | +|------|-------------|-------------|--------| +| ADR-004: Package Manager MCP Bridge decision record | None | Small | ✅ Done | +| `product-specs/specs/base-prompt.md` — daemon-level system prompt | None | Small | Pending | +| `cognitiveos.package.*` domain in mcp-conventions.md | None | Small | Pending | +| `validate_package_request` RPC in raw-model.md spec | None | Small | Pending | +| Validation-hook section in cognitiveosd-api.md | None | Small | Pending | +| `package-mcp` bridge in core-mcp-bridges/ | MCP server library | Medium | Pending | +| MCP validation hook in cognitiveosd mcp_lifecycle.go | cognitiveosd-api spec | Small | Pending | +| `validate_package_request` handler in cograw | raw-model.md spec | Small | Pending | +| `ValidatePackageRequest` method in raw_client.go | None | Small | Pending | +| `package-mcp` in default MCPBridges config | None | Small | Pending | +| Base system prompt injection in daemon startup | None | Small | Pending | +| Tool validation wiring in handlers.go (toolLoop) | None | Small | Pending | + +**Definition of done:** +- Wide Model calls `cognitiveos.package.search("photo viewer")` → daemon validates → package-mcp runs `cpm search` +- Wide Model calls `cognitiveos.package.install("photo-viewer")` → daemon validates via Raw Model → package-mcp runs `cpm install` +- Raw Model denies install if manifest contains `raw_model` field +- Raw Model enforces rate limit (5 ops / 5 min) +- Read-only ops (search/list/info) go through validation with reduced checks +- Base system prompt tells the Wide Model it can autonomously install capabilities +- All 6 package tools are registered and discoverable via `mcp.list_tools` + ## Build Order with Milestones ``` From 7136cf01d93bc3a7fa1cbaca4a03703628cdefed Mon Sep 17 00:00:00 2001 From: Jean Machuca Date: Mon, 6 Jul 2026 01:50:03 +0000 Subject: [PATCH 2/3] fix: check_go_build and check_go_vet now cd into repo dir before running Go commands --- scripts/healthcheck.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/healthcheck.sh b/scripts/healthcheck.sh index 7df1ce5..62aa949 100755 --- a/scripts/healthcheck.sh +++ b/scripts/healthcheck.sh @@ -49,11 +49,10 @@ EOF check() { local name="$1" status="$2" detail="$3" - local tag="" case "$status" in - pass) tag="PASS"; pass=$((pass+1)) ;; - fail) tag="FAIL"; fail=$((fail+1)) ;; - skip) tag="SKIP"; skip=$((skip+1)) ;; + pass) pass=$((pass+1)) ;; + fail) fail=$((fail+1)) ;; + skip) skip=$((skip+1)) ;; esac if [ "$MODE_QUIET" -eq 0 ]; then case "$status" in @@ -96,7 +95,7 @@ check_go_build() { check "go build $label" skip "go not installed" return fi - if CGO_ENABLED=0 go build -o /dev/null ./... 2>&1; then + if (cd "$dir" && CGO_ENABLED=0 go build -o /dev/null ./... 2>&1); then check "go build $label" pass else check "go build $label" fail "build error" @@ -109,7 +108,7 @@ check_go_vet() { check "go vet $label" skip "go not installed" return fi - if go vet ./... 2>&1; then + if (cd "$dir" && go vet ./... 2>&1); then check "go vet $label" pass else check "go vet $label" fail "vet errors" @@ -139,7 +138,7 @@ check_shellcheck() { local errors=0 for script in "$dir"/scripts/*.sh; do [ -f "$script" ] || continue - shellcheck -s sh -S warning "$script" 2>/dev/null || errors=$((errors+1)) + shellcheck -S warning "$script" 2>/dev/null || errors=$((errors+1)) done if [ "$errors" -eq 0 ]; then check "shellcheck $label" pass @@ -156,11 +155,12 @@ check_build_tags() { [ -f "$p" ] || continue head -1 "$p" | grep -q 'cgo' || { errors=$((errors+1)); check "build tag cgo on $f ($label)" fail "missing //go:build cgo"; } done - for f in cograw_llm.go; do - p="$dir/cmd/cograw/$f" - [ -f "$p" ] || continue - head -1 "$p" | grep -q 'cgo' || { errors=$((errors+1)); check "build tag cgo on $f ($label)" fail "missing //go:build cgo"; } - done + f="cograw_llm.go" + p="$dir/cmd/cograw/$f" + if [ -f "$p" ] && ! head -1 "$p" | grep -q 'cgo'; then + errors=$((errors+1)) + check "build tag cgo on $f ($label)" fail "missing //go:build cgo" + fi for f in cograw_stub.go backend_stub.go; do for d in cmd/cograw internal/server; do p="$dir/$d/$f" From 5c02c4f6d3c89598ace212f45988d2d42ff74e82 Mon Sep 17 00:00:00 2001 From: Jean Machuca Date: Sun, 5 Jul 2026 22:21:58 -0400 Subject: [PATCH 3/3] fix: add CGO_ENABLED=0 to go vet, suppress shellcheck SC3043 warning (#38) --- scripts/healthcheck.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/healthcheck.sh b/scripts/healthcheck.sh index 62aa949..4b1ad9b 100755 --- a/scripts/healthcheck.sh +++ b/scripts/healthcheck.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC3043 set -e # ── Config ── @@ -108,7 +109,7 @@ check_go_vet() { check "go vet $label" skip "go not installed" return fi - if (cd "$dir" && go vet ./... 2>&1); then + if (cd "$dir" && CGO_ENABLED=0 go vet ./... 2>&1); then check "go vet $label" pass else check "go vet $label" fail "vet errors"