Skip to content

chore(constitution): bump to v1.2.1 for AI orchestration carve-out - #17

Merged
chrisleekr merged 2 commits into
mainfrom
20260415-000159-triage-dispatch-modes
Apr 14, 2026
Merged

chrisleekr merged 2 commits into
mainfrom
20260415-000159-triage-dispatch-modes

Conversation

@chrisleekr

@chrisleekr chrisleekr commented Apr 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • PATCH-level amendment (v1.2.0 → v1.2.1) adding a one-line carve-out under Technology Constraints > AI orchestration that permits non-agent single-turn inference (classification, embedding, summarisation) via a forthcoming src/ai/llm-client.ts adaptor using the raw Anthropic or Bedrock SDKs.
  • Multi-turn tool-using flows remain exclusively on @anthropic-ai/claude-agent-sdk.
  • Sync Impact Report appended at the top; previous 1.2.0 block moved to historical. Version footer bumped.

Why this is a standalone PR

Per §Amendment Procedure, constitution changes must land as their own PR — not bundled with feature work — so reviewers can evaluate the governance change without feature-code distraction. This unblocks Phase 4 / US2 of the triage-dispatch-modes feature, whose src/ai/llm-client.ts path would otherwise violate the prior blanket "direct LLM calls forbidden" rule.

The triage call is a single-turn, no-tool classification; the prior ban was intended to prevent agent-loop bypasses, not pure inference. The carve-out is guarded by the circuit-breaker, latency, and cost requirements in FR-020 / SC-003 / SC-005 of the feature spec — referenced inline in the amended bullet so future readers can see the reference pattern.

Test plan

  • git diff --stat main...HEAD — exactly 1 file changed (.specify/memory/constitution.md, +36 / -3)
  • Sync Impact Report at top documents 1.2.0 → 1.2.1 with rationale, modified sections, template-update audit
  • Previous 1.2.0 → 1.1.0 and 1.1.0 → 1.0.0 report blocks preserved as historical
  • Version footer reads **Version**: 1.2.1 | **Ratified**: 2026-04-09 | **Last Amended**: 2026-04-15
  • CI (lint / format / typecheck / test) passes
  • No feature code shipped in this PR

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated AI orchestration policy governance to allow greater flexibility in single-turn inference operations when proper safeguards are in place.

Add a PATCH-level carve-out under Technology Constraints > AI
orchestration permitting non-agent single-turn inference
(classification, embedding, summarisation) via `src/ai/llm-client.ts`
using the raw Anthropic or Bedrock SDKs. Multi-turn tool-using flows
remain on `@anthropic-ai/claude-agent-sdk`.

Unblocks the triage-dispatch-modes feature
(specs/20260415-000159-triage-dispatch-modes). The triage call is a
single-turn no-tool classification; the prior blanket ban targeted
agent-loop bypasses, not pure inference. Carve-out is guarded by the
circuit-breaker, latency, and cost requirements in FR-020 / SC-003 /
SC-005 of that spec.

Per §Amendment Procedure this ships as a standalone PR ahead of any
feature code that depends on the carve-out.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 14, 2026 22:09
@coderabbitai

coderabbitai Bot commented Apr 14, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@chrisleekr has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 56 minutes and 4 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 56 minutes and 4 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 868ea4a0-175c-42a2-af49-89898e0a8a38

📥 Commits

Reviewing files that changed from the base of the PR and between 4c7ddba and b0e6e62.

📒 Files selected for processing (1)
  • .specify/memory/constitution.md
📝 Walkthrough

Walkthrough

The constitution's AI orchestration rule is revised from a blanket prohibition on direct LLM API calls to a conditional split policy: multi-turn agent flows remain restricted to the agent SDK, while single-turn inference tasks (classification, embedding, summarization) are permitted to use raw Anthropic or Bedrock SDKs, provided they enforce circuit-breaker, latency cap, and cost budget constraints. Version incremented to 1.2.1.

Changes

Cohort / File(s) Summary
Constitution Policy Update
.specify/memory/constitution.md
Updated Technology Constraints → AI orchestration rule to permit raw SDK usage for single-turn inference tasks under specified safety constraints; version bumped from 1.2.0 to 1.2.1.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 The constitution hops with grace,
Rules refined in their rightful place,
Single-turn flows now have their say,
While agents dance the SDK way,
With safeguards tight, we're good to go—
A balanced path, a prudent flow! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: a version bump to v1.2.1 for the AI orchestration carve-out policy documented in the constitution.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 20260415-000159-triage-dispatch-modes

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.

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.specify/memory/constitution.md:
- Around line 267-275: Add enforceable runtime guards for the “raw Anthropic or
Bedrock SDK” carve-out by (1) adding a startup/config assertion in src/config.ts
(e.g., assertThirdPartyLlmAllowed() or assertCircuitBreakerConfigured()) that
verifies required circuit-breaker, latency cap and cost budget settings are
present and fail-fast on misconfiguration, and (2) adding a runtime check in the
llm adaptor in src/ai/llm-client.ts (e.g., inside the client factory or call
method such as createLlmClient() or LlmClient.request()) that validates the same
invariants before performing a non-agent single-turn request and throws/returns
an auditable error if they aren’t satisfied; ensure the error messages reference
the policy and the config assertion so audits can trace enforcement.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 36ddbe55-d476-49d9-b351-a4282b9b1e0b

📥 Commits

Reviewing files that changed from the base of the PR and between 585156f and 4c7ddba.

📒 Files selected for processing (1)
  • .specify/memory/constitution.md

Comment thread .specify/memory/constitution.md Outdated
Comment on lines +267 to +275
- **AI orchestration**: `@anthropic-ai/claude-agent-sdk` for all
multi-turn, tool-using agent flows. Non-agent single-turn
inference (classification, embedding, summarisation) MAY use the
raw Anthropic or Bedrock SDKs via the `src/ai/llm-client.ts`
adaptor, provided the calling feature spec enforces a
circuit-breaker, latency cap, and cost budget (see
`specs/20260415-000159-triage-dispatch-modes` FR-020 / SC-003 /
SC-005 for the reference pattern). Multi-turn tool-using flows
MUST continue to use `@anthropic-ai/claude-agent-sdk`.

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

Make the carve-out enforceable at runtime, not only at spec level.

Lines 271–274 currently require constraints via “calling feature spec,” which is necessary but not sufficient for enforcement. Please require code-level guards (startup/config assertion + runtime check in the adaptor) so this policy is auditable and fail-fast.

Proposed wording tweak
 - **AI orchestration**: `@anthropic-ai/claude-agent-sdk` for all
   multi-turn, tool-using agent flows. Non-agent single-turn
   inference (classification, embedding, summarisation) MAY use the
   raw Anthropic or Bedrock SDKs via the `src/ai/llm-client.ts`
-  adaptor, provided the calling feature spec enforces a
-  circuit-breaker, latency cap, and cost budget (see
+  adaptor, provided the calling feature spec defines and the code
+  enforces (via startup/config assertions and runtime guards) a
+  circuit-breaker, latency cap, and cost budget (see
   `specs/20260415-000159-triage-dispatch-modes` FR-020 / SC-003 /
   SC-005 for the reference pattern). Multi-turn tool-using flows
   MUST continue to use `@anthropic-ai/claude-agent-sdk`.

Based on learnings, in chrisleekr/github-app-playground, security/compliance invariants are preferred as startup-time assertX() checks in src/config.ts to ensure fail-fast enforcement.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- **AI orchestration**: `@anthropic-ai/claude-agent-sdk` for all
multi-turn, tool-using agent flows. Non-agent single-turn
inference (classification, embedding, summarisation) MAY use the
raw Anthropic or Bedrock SDKs via the `src/ai/llm-client.ts`
adaptor, provided the calling feature spec enforces a
circuit-breaker, latency cap, and cost budget (see
`specs/20260415-000159-triage-dispatch-modes` FR-020 / SC-003 /
SC-005 for the reference pattern). Multi-turn tool-using flows
MUST continue to use `@anthropic-ai/claude-agent-sdk`.
- **AI orchestration**: `@anthropic-ai/claude-agent-sdk` for all
multi-turn, tool-using agent flows. Non-agent single-turn
inference (classification, embedding, summarisation) MAY use the
raw Anthropic or Bedrock SDKs via the `src/ai/llm-client.ts`
adaptor, provided the calling feature spec defines and the code
enforces (via startup/config assertions and runtime guards) a
circuit-breaker, latency cap, and cost budget (see
`specs/20260415-000159-triage-dispatch-modes` FR-020 / SC-003 /
SC-005 for the reference pattern). Multi-turn tool-using flows
MUST continue to use `@anthropic-ai/claude-agent-sdk`.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.specify/memory/constitution.md around lines 267 - 275, Add enforceable
runtime guards for the “raw Anthropic or Bedrock SDK” carve-out by (1) adding a
startup/config assertion in src/config.ts (e.g., assertThirdPartyLlmAllowed() or
assertCircuitBreakerConfigured()) that verifies required circuit-breaker,
latency cap and cost budget settings are present and fail-fast on
misconfiguration, and (2) adding a runtime check in the llm adaptor in
src/ai/llm-client.ts (e.g., inside the client factory or call method such as
createLlmClient() or LlmClient.request()) that validates the same invariants
before performing a non-agent single-turn request and throws/returns an
auditable error if they aren’t satisfied; ensure the error messages reference
the policy and the config assertion so audits can trace enforcement.

Copilot AI 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.

Pull request overview

Updates the repository constitution to clarify AI orchestration rules by allowing limited single-turn inference outside the agent SDK, while keeping multi-turn/tool-using flows constrained to the agent SDK.

Changes:

  • Add a PATCH-level (1.2.0 → 1.2.1) carve-out permitting non-agent single-turn inference via raw Anthropic/Bedrock SDKs (with guardrails) while preserving the agent-SDK requirement for multi-turn/tool flows.
  • Add a new Sync Impact Report block and move the prior report into the historical section.
  • Bump the constitution version footer to 1.2.1 and update amendment metadata.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .specify/memory/constitution.md Outdated
Comment on lines +270 to +274
raw Anthropic or Bedrock SDKs via the `src/ai/llm-client.ts`
adaptor, provided the calling feature spec enforces a
circuit-breaker, latency cap, and cost budget (see
`specs/20260415-000159-triage-dispatch-modes` FR-020 / SC-003 /
SC-005 for the reference pattern). Multi-turn tool-using flows

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

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

The constitution text references specs/20260415-000159-triage-dispatch-modes as a “reference pattern”, but that spec directory/file doesn’t exist in this repo (yet). This creates a broken internal reference; consider linking to an existing, ratified spec/issue/PR instead, or rewording to avoid hardcoding a path until it lands.

Copilot uses AI. Check for mistakes.
Comment thread .specify/memory/constitution.md Outdated
Comment on lines +270 to +271
raw Anthropic or Bedrock SDKs via the `src/ai/llm-client.ts`
adaptor, provided the calling feature spec enforces a

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

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

src/ai/llm-client.ts is referenced as the required adaptor, but there is no src/ai directory in the current repo. If this adaptor is “forthcoming”, consider explicitly marking it as planned/forthcoming (to avoid implying it exists today) or using a more abstract requirement (e.g., a single approved LLM client module) until the file lands.

Copilot uses AI. Check for mistakes.
- Drop specific file reference (`src/ai/llm-client.ts`) from the
  policy bullet — the constitution states policy, not paths. Adaptor
  module location is implementation detail, still constrained to the
  `src/ai/` namespace.
- Drop forward reference to an unmerged spec from the policy bullet
  (Sync Impact Report still carries it as historical rationale).
- Tighten the carve-out's enforcement contract to require all three
  layers: spec documentation, runtime guards in the adaptor, and
  fail-fast Zod config validation at startup. Addresses CodeRabbit's
  concern that "spec enforces" is too weak for a runtime invariant.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@chrisleekr

Copy link
Copy Markdown
Owner Author

Thanks for the reviews. Pushed commit b0e6e62 addressing the actionable items:

Copilot #1 (broken specs/... reference) — removed from the policy bullet. The Sync Impact Report retains it as historical rationale (legitimate, since reports document why a change was made at a point in time, and the spec PR is next in the stack).

Copilot #2 (forthcoming src/ai/llm-client.ts) — removed the specific file path from the policy bullet. Constitution now constrains to the src/ai/ namespace without naming a non-existent file. Implementation paths are not constitutional concerns.

CodeRabbit (enforceable at runtime) — partially adopted. The policy bullet now requires all three enforcement layers: (a) spec documentation, (b) runtime guards in the adaptor or call site, (c) fail-fast Zod config validation at startup. This addresses the spirit of your comment — enforcement cannot live in prose alone.

I did not add runtime guard code to the constitution itself. That's a category error: the constitution states policy, not implementation. The guard code belongs in the feature work (tasks T032 circuit breaker, T034 triage engine with timeout + budget, T005 config schema validation with superRefine) — all of which are tracked in specs/20260415-000159-triage-dispatch-modes/tasks.md and will be enforced by PR review and CI on the feature PR. The constitution's job is to make that contract non-negotiable, which the tightened triple-gate now does.

@chrisleekr
chrisleekr merged commit 59fb3db into main Apr 14, 2026
8 checks passed
@chrisleekr
chrisleekr deleted the 20260415-000159-triage-dispatch-modes branch April 14, 2026 22:15
chrisleekr added a commit that referenced this pull request Apr 15, 2026
- docs/dispatch-flow.md: new doc with the canonical cascade Mermaid
  diagram (ported from quickstart.md §Dispatch cascade) plus a node
  reference table pointing at source-of-truth modules. Uses
  high-contrast classDefs per GitHub Mermaid rendering requirements.
- CLAUDE.md: Active Technologies cleaned up — consolidated the
  automated update-agent-context.sh output, added a DispatchTarget /
  DispatchReason taxonomy line and references to dispatch-flow.md
  and the new dispatch-stats query module.
- plan.md: Constitution Check Principle IV row now cites the v1.2.1
  AI Orchestration carve-out (PR #17) + triple-gated enforcement so
  the feature's reliance on the amendment is recorded on the gate.
- tasks.md: Slice G entries (T055–T058, T060) marked complete with
  evidence notes. T059 (live webhook smoke test) deferred to the
  final PR description per scope — cannot be scripted here.

Quality gate (T058): `bun run check` green — 0 lint errors, 83
pre-existing warnings, prettier clean, 34/34 isolated test files
pass. Security-critical modules at ≥92% line coverage (T060).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@chrisleekr

Copy link
Copy Markdown
Owner Author

🎉 This PR is included in version 1.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants