Consult docs/ (architecture, MCP best practices) and plans/ (per-feature context and plans) when you need background on a subsystem or an in-flight feature.
For every non-trivial feature, maintain a file pair in plans/ and commit it alongside the feature PR:
plans/
├── <feature>.context.md ← prompt, links, open questions, discussion log
└── <feature>.plan.md ← implementation plan
- Before implementing, check
plans/for an existing context file for the feature. - After each brainstorm exchange, append a dated entry to the discussion log in
.context.md. - When the plan changes, rewrite the relevant section in
.plan.mdand note the change with a dated entry in.context.md. - Mark open questions as resolved (with the answer inline) when they are settled in discussion.
- The discussion log in
.context.mdis append-only — never rewrite or delete prior log entries; it is the audit trail of why decisions were made. Only the Open Questions checklist may be updated in place (rule 4). .plan.mdis rewritten freely — it always reflects current thinking, not history.- Add a
## Statusline at the top of every.plan.md:Planning— actively being designedIn Progress— implementation underwayDone— shipped
File templates for both files live in plans/TEMPLATES.md.
- Conventional commits:
feat:,fix:,chore:,refactor:,test:,docs:. - PR titles must follow the same conventional-commit format, e.g.
chore(rate-limits): centralize override defaults. - Create GitHub issues in
SigNoz/nerve-podby default. Only use another repo when the user explicitly asks for that specific repo. - Keep PR body in sync with actual changes.
- Avoid long inline code comments unless needed; keep comments concise and non-redundant.
- Tests:
go test ./...(make testruns them verbose). - Build:
go build ./cmd/server(make buildalso rewrites formatting/imports). - Formatting/imports:
make fmt goimports.
Changes to client-visible MCP surfaces must follow docs/mcp-best-practices.md
and its section 11 review checklist. Deterministic budgets and CI mechanics stay
in guardrails/README.md. The companion SigNoz/agent-skills repo depends on
these contracts — audit it on every contract change (CMP-3; see the sync
checklist below).
- Follow
guardrails/README.md; keep policy inguardrails/policy.go, the sortedTestGuardrail_*inventory inguardrails/tests.txt, and package-sensitive tests beside their packages. - Never weaken a guardrail merely to pass CI. Document intentional relaxations in the feature context log and PR summary.
- Run the workflow lint, focused guardrail suite, and full test suite documented in
guardrails/README.mdbefore handoff.
When adding, removing, renaming, or otherwise changing a client-visible MCP tool, resource, prompt, or configuration contract, update docs and metadata in the same PR.
- Every MCP tool input schema must expose a top-level
searchContextstring with the user's original question/search text. Do not putsearchContextin the JSON Schemarequiredlist or describe it as optional. For tools usingmcp.WithInputSchema[T](), putSearchContextonTitself because typed schemas replace earliermcp.WithString("searchContext", ...)options. - Update
README.mdtool tables/parameter references to match current behavior. - Update
manifest.jsontool metadata (tools, descriptions, and related fields) to match registered handlers. - Review any user-facing docs under
docs/for stale references. - The companion SigNoz/agent-skills repo depends on this server's tool contracts. Apply CMP-3 in
docs/mcp-best-practices.md: state in the PR summary whether agent-skills needs a companion change, and link that PR when needed. Changes to the contract skills teach (a renamed/removed tool or parameter, payload shape, documented behavior — like thequery→filterrename) require a skills update; additive or internal changes do not. - Mention these doc updates explicitly in the PR summary.
Verifying against a live SigNoz instance — creating/reading/updating/deleting real alerts, dashboards, or views, or any multi-step API probing with credentials — should be delegated to a subagent (Agent tool), not run inline. The subagent must: delete every resource it creates and confirm it's gone; never print or persist credentials; report which fields round-tripped server-side; and prefer copying an existing resource's shape over hand-crafting one.
This server consumes the SigNoz backend / query-builder (QB) API upstream and produces tool outputs that MCP clients consume downstream. Fixture-based unit tests only prove our code matches our assumption of those contracts — they do not catch upstream drift (a renamed field, a changed QB envelope, a new output shape). For any code that parses an upstream response or shapes a tool output:
- Test against reality where you can. Beyond fixtures, add a periodic/integration test against a live SigNoz instance (or a recorded real response) so upstream drift fails a test, not a user.
- When tests can't catch it, observability must. Add a metric or WARN log that fires when the contract appears violated. Silent degradation that no test and no signal can catch is the failure mode to design against.
- Do not hide global upstream failures inside partial item results. SigNoz 401/403 must propagate through the shared coded error path (
upstreamErrorfor tools) so clients can re-authenticate or handle permissions. - Fail open, but never fail silent. Prefer fail-open cross-boundary parsing, always paired with a detectable signal.