Skip to content

feat: agent manifest with declarative tooling and build pipeline - #74

Merged
pavelanni merged 21 commits into
mainfrom
feature/agent-manifest
May 21, 2026
Merged

pavelanni merged 21 commits into
mainfrom
feature/agent-manifest

Conversation

@pavelanni

@pavelanni pavelanni commented May 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a declarative agent manifest (agent-manifest.yaml) that defines an agent as: base image + installed tools + system prompt + skills
  • Introduces a tiered tool catalog with risk scoring (core/standard/extended/runtime) to govern which OS tools can be installed in hardened images
  • New docsclaw build and docsclaw deploy commands generate Containerfiles, K8s manifests, and tools.json from the manifest
  • At runtime, the agent reads /etc/docsclaw/tools.json and injects the available tool list into the system prompt, preventing wasted agentic loop iterations on missing tools
  • New Makefile targets (agent-build, agent-image, agent-push) for building custom agent images with two-stage Containerfile and remote podman support

Motivation

We hit a problem where LLMs waste agentic loop iterations trying tools that aren't installed (jq, python3, node). The agent manifest + tool catalog + runtime injection solves this by declaring tools upfront and telling the LLM exactly what's available.

New packages

Package Purpose
pkg/catalog Tool catalog with tiers, risk scores, package mappings
pkg/manifest Manifest parser, compatibility checker, Containerfile/K8s/tools.json generators

New commands

Command Purpose
docsclaw build --manifest Validate tools, check skill compat, generate artifacts
docsclaw deploy --manifest Generate K8s YAML with secret resolution from env vars

Test plan

  • Unit tests for catalog, manifest, compatibility, generators (30+ tests)
  • make agent-build generates Containerfile + tools.json
  • make agent-image PODMAN_CONNECTION=rhel builds on remote host
  • docsclaw deploy resolves secrets from env vars and --secret flags
  • Deployed on OpenShift — agent runs with tools installed, tools.json loaded, probes passing
  • Verified: oc exec -- cat /etc/docsclaw/tools.json shows correct inventory

Design doc

docs/superpowers/specs/2026-05-20-agent-manifest-tooling-design.md

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Declarative agent manifest for building custom agent container images
    • New CLI commands to build and deploy agents, including manifest-driven dry-run, build/push, and secret resolution
    • Tool catalog with tiering and risk scoring; generated tools.json and agent metadata embedded in images
    • Kubernetes manifest generation for agent deployments; Makefile targets to build/push agent images
    • Runtime prompt now lists available OS tools when provided
  • Documentation

    • Added guides for agent-manifest workflow, build/push, and deployment
  • Tests

    • Added extensive unit tests covering build, deploy, manifest parsing, catalog, and compatibility checks

pavelanni added 17 commits May 20, 2026 16:01
Declarative agent manifest, tiered tool catalog with risk scoring,
build/deploy CLI, skill compatibility checking, and shopping cart UI
for assembling agents from base image + tools + prompt + skills.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
10-task TDD plan covering tool catalog, manifest parsing,
compatibility checking, Containerfile/K8s generation, build/deploy
commands, and runtime tools.json integration.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
Tiered tool catalog (core/standard/extended/runtime) with per-tool
risk scores, distro-specific package names, and embedded default
catalog.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
AgentManifest declares base image, OS tools, system prompt, skills,
secrets, and deployment config. Validation ensures required fields
are present.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
Validates that manifest tools satisfy skill requirements from
skill.yaml. Reports missing required and optional tools. Skills
without skill.yaml are flagged as unknown.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
Generates Containerfile with dnf bind-mount pattern, OCI annotation
labels (installed tools, tier, risk score, agent name), and hardened
image security comment.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
Generates /etc/docsclaw/tools.json with installed tool inventory,
tier, risk scores for runtime compatibility checking.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
Generates ConfigMap, Deployment, Service, ServiceAccount, and Secret
YAML with hardened security context and skill image volumes.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
Reads agent manifest, validates tools against catalog, checks skill
compatibility, and generates Containerfile + K8s manifests to an
output directory.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
Generates K8s manifests with secrets resolved from --secret flags
or environment variables. Output is pipeable to oc apply -f -.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
At startup, reads /etc/docsclaw/tools.json and appends available
tool names to the system prompt so the LLM knows exactly which
OS tools exist. Prevents wasted agentic loop iterations on
missing tools.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
Use t.Setenv instead of os.Setenv in tests, discard fmt.Fprintf
return values in report output, add return after t.Fatal to satisfy
staticcheck nil pointer analysis.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
New targets: agent-build, agent-image, agent-push — build a custom
agent container image from an agent manifest. Cross-compiles the
binary for linux/amd64, generates the Containerfile, and builds
with podman (supports PODMAN_CONNECTION for remote RHEL hosts).

Also embeds tools.json into /etc/docsclaw/tools.json in the generated
Containerfile for runtime tool inventory.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
Replace $(shell mktemp -d) with build/agent — Make re-evaluated
the temp dir for each rule, so agent-build and agent-image got
different paths.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
The generated Containerfile now includes a Go builder stage so
compilation happens on the build host (e.g. RHEL via remote
podman) instead of requiring local cross-compilation. The base
image field is split into goBuilder (defaults to hi/go:latest)
and toolBuilder (for dnf bind-mount).

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
The K8s Deployment now uses spec.deploy.image as the container
image. Falls back to spec.base.image if not set.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
Use /health for liveness and /ready for readiness to match the
actual endpoints registered by the health server.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
@coderabbitai

coderabbitai Bot commented May 20, 2026 •

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR implements a declarative AgentManifest pipeline: a tiered tool catalog and YAML manifest types, compatibility checks, generators for Containerfile/tools.json/Kubernetes manifests, docsclaw build and docsclaw deploy CLI commands, runtime tools.json loading, Makefile targets, tests, and comprehensive docs.

Changes

Agent Manifest Feature

Layer / File(s) Summary
Tool Catalog and Data Structures
pkg/catalog/types.go, pkg/catalog/catalog.go, pkg/catalog/default.yaml, pkg/catalog/catalog_test.go, pkg/catalog/testdata/*, pkg/manifest/types.go
Introduces a tiered ToolCatalog with core/standard/extended/runtime tiers, per-tool risk metadata, loader/parsers, and types for AgentManifest.
Manifest Parsing and Test Fixtures
pkg/manifest/parse.go, pkg/manifest/parse_test.go, testdata/manifest/*
Parses and validates AgentManifest YAML (required name, base image, and mutually exclusive prompt text/source) and provides valid and invalid manifest fixtures.
Skill Compatibility Checking
pkg/manifest/check.go, pkg/manifest/check_test.go
Converts SkillCard to SkillCheck and computes CheckResult per skill comparing manifest tools plus catalog core tools to skill requirements (required vs optional).
Containerfile, tools.json, agent-config generators
pkg/manifest/containerfile.go, pkg/manifest/containerfile_test.go, pkg/manifest/toolsjson.go, pkg/manifest/toolsjson_test.go, pkg/manifest/agentconfig.go
Generates hardened Containerfile template (labels, optional builder stage), tools.json runtime inventory with per-tool risk and package mappings, and conditional agent runtime YAML. Tests validate rendering, labels, and core-only cases.
Kubernetes manifest generator
pkg/manifest/k8s.go, pkg/manifest/k8s_test.go
Renders ConfigMap (system-prompt + agent-config), Deployment (securityContext, skill volumes, optional secrets), Service, ServiceAccount, and optional Secret; includes unit tests for each artifact.
Build CLI Command Orchestration
internal/cmd/build.go
Implements docsclaw build: manifest parsing, catalog loading/validation, compatibility/risk report, --max-risk enforcement, --dry-run, and writing Containerfile/tools.json or k8s artifacts to disk or stdout.
Deploy CLI Command and Secret Resolution
internal/cmd/deploy.go, internal/cmd/deploy_test.go
Implements docsclaw deploy: resolves secrets (CLI flag overrides → env vars), generates K8s manifests via manifest generator, and writes or prints outputs in deterministic order; tests cover precedence and error cases.
Runtime Integration, Build Automation, and Docs
internal/cmd/serve.go, internal/cmd/serve_tools_test.go, Makefile, .gitignore, README.md, docs/agent-manifest-guide.md, docs/superpowers/plans/*, docs/superpowers/specs/*
Adds loader for /etc/docsclaw/tools.json to inject "Available OS tools" into the system prompt, Makefile targets for agent build/image/push and cleanup, .gitignore entries, a user guide, an implementation plan, and a detailed design spec.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • redhat-et/docsclaw#21: Related work introducing SkillCard/OCI skill distribution that CheckCompatibility consumes.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.12% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically describes the main feature addition: agent manifest with declarative tooling and build pipeline, which matches the core changes introducing AgentManifest YAML, ToolCatalog, and docsclaw build/deploy commands.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/agent-manifest

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

pavelanni added 2 commits May 20, 2026 18:35
Three-step workflow: write manifest, build/push image, deploy to
OpenShift. Covers tool catalog tiers, remote podman builds, secret
resolution, skill compatibility, and image metadata inspection.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
- Deduplicate mergeWithCore into exported MergeWithCore (#1)
- Unify buildAgentConfigYAML into pkg/manifest, fixing empty
  allowed list and missing webFetch in k8s.go version (#2)
- Document ImageVolumeSource feature gate requirement (#3)
- Print K8s manifests to stdout with --only k8s (#4)
- Fix agent-config.yaml write condition to check all runtime
  config fields (#5)
- Remove unused error return from buildAgentConfigYAML (#6)
- Add trailing newline to tools.json output (#7)

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
@pavelanni
pavelanni marked this pull request as ready for review May 20, 2026 23:06

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 11

🧹 Nitpick comments (3)
pkg/manifest/check_test.go (1)

15-15: ⚡ Quick win

Handle LoadDefault() errors explicitly in tests.

Ignoring these errors can hide fixture/catalog load failures and make test failures less actionable. Fail fast with t.Fatalf (or a small helper).

Suggested patch
 func TestCheckCompatibility_AllSatisfied(t *testing.T) {
 	tools := []string{"curl", "jq"}
 	skills := []SkillCheck{
 		{Name: "nps-api", Required: []string{"curl", "jq"}, HasSkillYAML: true},
 	}
-	cat, _ := catalog.LoadDefault()
+	cat, err := catalog.LoadDefault()
+	if err != nil {
+		t.Fatalf("LoadDefault() error: %v", err)
+	}
 
 	results := CheckCompatibility(tools, skills, cat)
@@
 func TestCheckCompatibility_MissingRequired(t *testing.T) {
@@
-	cat, _ := catalog.LoadDefault()
+	cat, err := catalog.LoadDefault()
+	if err != nil {
+		t.Fatalf("LoadDefault() error: %v", err)
+	}
@@
 func TestCheckCompatibility_OptionalMissing(t *testing.T) {
@@
-	cat, _ := catalog.LoadDefault()
+	cat, err := catalog.LoadDefault()
+	if err != nil {
+		t.Fatalf("LoadDefault() error: %v", err)
+	}
@@
 func TestCheckCompatibility_NoSkillYAML(t *testing.T) {
@@
-	cat, _ := catalog.LoadDefault()
+	cat, err := catalog.LoadDefault()
+	if err != nil {
+		t.Fatalf("LoadDefault() error: %v", err)
+	}

Also applies to: 34-34, 55-55, 71-71

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/manifest/check_test.go` at line 15, The test currently ignores errors
from catalog.LoadDefault() (e.g., "cat, _ := catalog.LoadDefault()") which can
hide fixture/load failures; update every occurrence (lines referenced where
catalog.LoadDefault() is called) to capture the returned error and fail the test
immediately on error using t.Fatalf (or a small helper), e.g., check "cat, err
:= catalog.LoadDefault()" and call "t.Fatalf(...)" when err != nil so the test
fails fast with the error details.
internal/cmd/deploy.go (1)

63-69: ⚡ Quick win

Use structured logging instead of direct stderr writes.

Line 67 emits status with fmt.Fprintf(os.Stderr, ...), which bypasses structured logs and makes CLI output less consistent with the rest of Go commands. Prefer log/slog (or your structured logger wrapper) for this event.

As per coding guidelines, **/*.go: Use log/slog for structured logging throughout the codebase.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/cmd/deploy.go` around lines 63 - 69, Replace the direct stderr write
in the deploy flow with structured logging: in the block that checks outputDir
and calls writeK8sOutputs(outputDir, k8sOutput), remove fmt.Fprintf(os.Stderr,
...) and emit a structured info log via the project logger (e.g., log/slog or
the repo's logger wrapper) indicating success and including outputDir (and
optionally the k8s path) as a key/value; ensure the same logger is used
consistently with other CLI logs and keep printK8sManifests unchanged for the
else branch.
docs/superpowers/plans/2026-05-20-agent-manifest.md (1)

226-227: ⚡ Quick win

Avoid machine-specific absolute paths in runbooks.

Hardcoded paths like /Users/panni/work/docsclaw make the plan non-portable and error-prone for other contributors and CI docs consumers. Use repo-root-relative commands instead.

Also applies to: 385-386, 671-672, 726-727, 731-732, 861-862, 940-941, 1062-1063, 1170-1171, 1489-1490, 1529-1530, 1607-1611, 1717-1718, 1838-1851

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/superpowers/plans/2026-05-20-agent-manifest.md` around lines 226 - 227,
Replace machine-specific absolute paths like "/Users/panni/work/docsclaw" used
in run examples (e.g., the line "Run: `cd /Users/panni/work/docsclaw && go test
./pkg/catalog/ -v`") with repo-root-relative commands; update those lines to
either use a portable repo root helper such as "cd $(git rev-parse
--show-toplevel)" or simply "cd repo-root && go test ./pkg/catalog -v" (or use a
Makefile / script target) and apply the same change to the other occurrences
called out in the comment so all runbook commands are portable across
environments.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/agent-manifest-guide.md`:
- Around line 291-300: The fenced code block that starts with "Checking skill
compatibility..." is unlabeled and triggers markdownlint MD040; change the
opening fence from ``` to ```text for that block (the block containing the lines
"Checking skill compatibility..." through the closing fence) so the code block
has a language identifier while leaving the closing ``` unchanged.

In `@docs/superpowers/plans/2026-05-20-agent-manifest.md`:
- Around line 226-227: Replace all direct invocations of Go and lint tooling in
the plan (e.g., occurrences of `go test ./pkg/...`, `golangci-lint run`, and
similar raw commands) with the canonical Make targets (`make test`, `make lint`,
`make build`, `make fmt`) so the documented workflow matches the project’s
required entrypoints; update each instance called out (including the examples
around `Run: cd ... && go test ./pkg/catalog/ -v` and the other noted locations)
to use the appropriate `make` target that performs the same action.

In `@docs/superpowers/specs/2026-05-20-agent-manifest-tooling-design.md`:
- Around line 465-470: The documentation currently shows a runnable "docsclaw
build --manifest agent-manifest.yaml --push" example while the implementation
plan marks --push/image build as out-of-scope; update the spec so the examples
and narrative are consistent: either remove or mark the "--push" example and any
image-build invocation (e.g., the "docsclaw build --manifest agent-manifest.yaml
--push --tag ghcr.io/org/nps-agent:1.0.0" line) as "future work / not yet
implemented", or change the implementation plan to include support for --push
and image building; also ensure the "--max-risk" example (docsclaw build
--manifest agent-manifest.yaml --max-risk 6) remains accurate and unchanged if
supported.
- Around line 86-90: The manifest example uses snake_case keys (`max_output`,
`max_iterations`) that conflict with the implementation/schema which expects
camelCase (`maxOutput`, `maxIterations`); update the example to use `maxOutput`
under the exec block and `maxIterations` under the loop block (or alternatively
align the schema to accept snake_case) so manifests validate correctly against
the types that reference maxOutput and maxIterations.

In `@internal/cmd/build.go`:
- Around line 35-37: The build command currently emits no generated artifacts
when both flags "output" and "only" are empty; change the build command handler
(the buildCmd Run function / the code that reads the "output" and "only" flags)
so that an empty "output" is treated as stdout (e.g., use "-" or os.Stdout) and
the generator still writes artifacts unless "--only" explicitly restricts
generation; apply the same fix to the other build logic paths referenced around
the 102-142 block so that when "output" is unset the generated files are written
to stdout and not dropped.

In `@internal/cmd/serve.go`:
- Around line 307-313: Sanitize tool names from tj.Tools before appending them
to systemPrompt: iterate over each t in tj.Tools and validate/normalize t.Name
(e.g., remove control characters like newlines, tabs, and any characters outside
an allowlist of letters, numbers, spaces, hyphens, and underscores), then append
the cleaned values to names and use strings.Join(names, ", ") as before; ensure
the sanitization runs where names is populated so systemPrompt only receives
validated, safe strings and cannot be corrupted by embedded control text.

In `@pkg/catalog/catalog.go`:
- Around line 38-44: The parse function uses yaml.Unmarshal which ignores
unknown YAML keys; change it to decode with strict validation by creating a
yaml.Decoder (yaml.NewDecoder) for the input bytes and call KnownFields(true)
before Decode so unknown fields cause an error; update the parse function to use
that decoder and return the decoder error (wrapping with fmt.Errorf like "parse
catalog: %w") so typos (e.g., "teir") are rejected and downstream logic in
HighestTier()/tierOrder sees only validated data.
- Around line 69-70: The comparison in HighestTier uses tierOrder[entry.Tier]
without checking existence, so unknown tiers silently map to 0; update
HighestTier to validate the map lookup (use the comma-ok form) for
tierOrder[entry.Tier] and skip or treat unknown tiers as an error/placeholder
(e.g., continue or log) instead of comparing; refer to symbols HighestTier,
tierOrder, entry.Tier and highest and ensure callers like LoadFromFile or the
parser either validate tiers earlier or surface validation errors when an
unknown tier is encountered.

In `@pkg/manifest/k8s.go`:
- Around line 86-90: The ServiceAccount name is hardcoded as "docsclaw-agent"
(see saData struct) which can cause collisions; update the code that builds
ServiceAccount and related manifests (references around saData and the other
occurrences noted) to derive the name dynamically from the agent/deployment
identifier (for example use a manifest or deployment name variable, agent ID, or
a generated unique suffix) instead of the literal "docsclaw-agent", and
propagate that dynamic name to all places that reference the ServiceAccount so
each agent gets a unique ServiceAccount name.
- Around line 153-156: The ConfigMap template interpolates .SystemPrompt without
re-indenting multiline content, which breaks YAML; update the template so the
system prompt block uses the same re-indentation helper as agent-config.yaml
(i.e., replace the bare {{.SystemPrompt}} usage with a call that nindents the
value) so multiline SystemPrompt content is rendered correctly; look for the
template fragment containing "system-prompt.txt: |" and change the interpolation
of .SystemPrompt to use the nindent helper (matching how .AgentConfigYAML is
handled).

In `@pkg/manifest/parse.go`:
- Around line 20-22: The current use of yaml.Unmarshal(data, &m) silently
ignores unknown YAML keys; replace it with a strict decoder: create a
yaml.NewDecoder over the data (e.g., bytes.NewReader(data)), call
decoder.KnownFields(true) and then decoder.Decode(&m), and propagate the
returned error the same way (fmt.Errorf("parse manifest: %w", err)) so unknown
manifest keys cause a parse error; refer to the existing variables/data and m,
and the yaml.Unmarshal call to locate where to change to yaml.NewDecoder +
KnownFields(true) + Decode.

---

Nitpick comments:
In `@docs/superpowers/plans/2026-05-20-agent-manifest.md`:
- Around line 226-227: Replace machine-specific absolute paths like
"/Users/panni/work/docsclaw" used in run examples (e.g., the line "Run: `cd
/Users/panni/work/docsclaw && go test ./pkg/catalog/ -v`") with
repo-root-relative commands; update those lines to either use a portable repo
root helper such as "cd $(git rev-parse --show-toplevel)" or simply "cd
repo-root && go test ./pkg/catalog -v" (or use a Makefile / script target) and
apply the same change to the other occurrences called out in the comment so all
runbook commands are portable across environments.

In `@internal/cmd/deploy.go`:
- Around line 63-69: Replace the direct stderr write in the deploy flow with
structured logging: in the block that checks outputDir and calls
writeK8sOutputs(outputDir, k8sOutput), remove fmt.Fprintf(os.Stderr, ...) and
emit a structured info log via the project logger (e.g., log/slog or the repo's
logger wrapper) indicating success and including outputDir (and optionally the
k8s path) as a key/value; ensure the same logger is used consistently with other
CLI logs and keep printK8sManifests unchanged for the else branch.

In `@pkg/manifest/check_test.go`:
- Line 15: The test currently ignores errors from catalog.LoadDefault() (e.g.,
"cat, _ := catalog.LoadDefault()") which can hide fixture/load failures; update
every occurrence (lines referenced where catalog.LoadDefault() is called) to
capture the returned error and fail the test immediately on error using t.Fatalf
(or a small helper), e.g., check "cat, err := catalog.LoadDefault()" and call
"t.Fatalf(...)" when err != nil so the test fails fast with the error details.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 750883cd-589b-490e-929d-35e47b360c82

📥 Commits

Reviewing files that changed from the base of the PR and between be94606 and 4b7ecc2.

📒 Files selected for processing (30)
  • .gitignore
  • Makefile
  • README.md
  • docs/agent-manifest-guide.md
  • docs/superpowers/plans/2026-05-20-agent-manifest.md
  • docs/superpowers/specs/2026-05-20-agent-manifest-tooling-design.md
  • internal/cmd/build.go
  • internal/cmd/deploy.go
  • internal/cmd/deploy_test.go
  • internal/cmd/serve.go
  • internal/cmd/serve_tools_test.go
  • pkg/catalog/catalog.go
  • pkg/catalog/catalog_test.go
  • pkg/catalog/default.yaml
  • pkg/catalog/testdata/custom-catalog.yaml
  • pkg/catalog/types.go
  • pkg/manifest/agentconfig.go
  • pkg/manifest/check.go
  • pkg/manifest/check_test.go
  • pkg/manifest/containerfile.go
  • pkg/manifest/containerfile_test.go
  • pkg/manifest/k8s.go
  • pkg/manifest/k8s_test.go
  • pkg/manifest/parse.go
  • pkg/manifest/parse_test.go
  • pkg/manifest/toolsjson.go
  • pkg/manifest/toolsjson_test.go
  • pkg/manifest/types.go
  • testdata/manifest/bad-manifest.yaml
  • testdata/manifest/nps-agent.yaml

Comment thread docs/agent-manifest-guide.md Resolved
Comment on lines +226 to +227
Run: `cd /Users/panni/work/docsclaw && go test ./pkg/catalog/ -v`
Expected: compilation errors — `LoadDefault`, `Lookup`, etc. not defined.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use Makefile entrypoints in the plan instead of raw go test/golangci-lint commands.

The plan currently documents direct tool invocations, which drifts from the project’s required workflow and can produce inconsistent local/CI behavior. Replace these with make test, make lint, make build, and make fmt where applicable.

As per coding guidelines, "Build binary to bin/docsclaw using make build command; Run all tests using make test command; Run golangci-lint using make lint command; Format code using make fmt command".

Also applies to: 385-386, 671-672, 726-727, 861-862, 1062-1063, 1170-1171, 1489-1490, 1530-1531, 1607-1611, 1717-1718, 1838-1845

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/superpowers/plans/2026-05-20-agent-manifest.md` around lines 226 - 227,
Replace all direct invocations of Go and lint tooling in the plan (e.g.,
occurrences of `go test ./pkg/...`, `golangci-lint run`, and similar raw
commands) with the canonical Make targets (`make test`, `make lint`, `make
build`, `make fmt`) so the documented workflow matches the project’s required
entrypoints; update each instance called out (including the examples around
`Run: cd ... && go test ./pkg/catalog/ -v` and the other noted locations) to use
the appropriate `make` target that performs the same action.

Comment thread internal/cmd/build.go
Comment on lines +35 to +37
buildCmd.Flags().String("manifest", "", "Path to agent-manifest.yaml (required)")
buildCmd.Flags().String("output", "", "Directory to write generated files (default: print to stdout)")
buildCmd.Flags().String("only", "", "Generate only 'containerfile' or 'k8s'")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Prevent the default build path from producing no artifacts.

With neither --output nor --only, the command prints only the report and emits no generated artifacts, despite the help text saying stdout is the default.

Proposed fix
-	buildCmd.Flags().String("output", "", "Directory to write generated files (default: print to stdout)")
+	buildCmd.Flags().String("output", "", "Directory to write generated files")
@@
 	// Validate --only flag
 	if onlyMode != "" && onlyMode != "containerfile" && onlyMode != "k8s" {
 		return fmt.Errorf("--only must be 'containerfile' or 'k8s'")
 	}
+	if outputDir == "" && onlyMode == "" {
+		return fmt.Errorf("either --output or --only must be set")
+	}

Also applies to: 102-142

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/cmd/build.go` around lines 35 - 37, The build command currently
emits no generated artifacts when both flags "output" and "only" are empty;
change the build command handler (the buildCmd Run function / the code that
reads the "output" and "only" flags) so that an empty "output" is treated as
stdout (e.g., use "-" or os.Stdout) and the generator still writes artifacts
unless "--only" explicitly restricts generation; apply the same fix to the other
build logic paths referenced around the 102-142 block so that when "output" is
unset the generated files are written to stdout and not dropped.

Comment thread pkg/catalog/catalog.go Resolved
Comment thread pkg/catalog/catalog.go Resolved
Comment thread pkg/manifest/k8s.go Resolved
Comment thread pkg/manifest/k8s.go Resolved
Comment thread pkg/manifest/parse.go Resolved
- Strict YAML parsing with KnownFields(true) for catalog and
  manifest to reject typos in YAML keys
- Sanitize tool names from tools.json before injecting into
  system prompt to prevent control character injection
- Fix HighestTier to skip unknown tiers instead of treating
  them as core
- Fix SystemPrompt indentation in K8s ConfigMap template using
  nindent helper
- Add trailing newline to tools.json output
- Fix check_test.go to fail fast on catalog load errors
- Fix snake_case keys in spec example to match camelCase schema
- Mark --push flag as future work in spec
- Add language label to fenced code block in guide

Skipped findings:
- Plan doc paths/make targets: internal agent doc, not a runbook
- build.go stdout without flags: intentional report-only UX
- ServiceAccount naming: shared SA is the deployment pattern
- deploy.go logging: stderr is standard for CLI commands

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
…count

Defaults to "docsclaw-agent" when omitted. Allows users to bind
agent-specific RBAC roles to custom ServiceAccounts.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
@pavelanni
pavelanni merged commit 0211e82 into main May 21, 2026
4 checks passed
@pavelanni
pavelanni deleted the feature/agent-manifest branch May 21, 2026 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant