From 4a23b6f165115cd3a8e84a4a8261a571eea924d0 Mon Sep 17 00:00:00 2001 From: Jared Pleva Date: Mon, 6 Apr 2026 01:55:38 +0000 Subject: [PATCH 1/2] docs: add Copilot + @claude agent configuration Add GitHub Actions workflow for claude-code-action, copilot-instructions.md for Tier C agent governance, and CLAUDE.md for project context. Part of Chitin assembly line v2 rollout. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/copilot-instructions.md | 98 +++++++++++++++++++++++++++++++++ .github/workflows/claude.yml | 20 +++++++ CLAUDE.md | 36 ++++++++++++ 3 files changed, 154 insertions(+) create mode 100644 .github/copilot-instructions.md create mode 100644 .github/workflows/claude.yml create mode 100644 CLAUDE.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..e812613 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,98 @@ +# LLMint — Copilot Instructions + +> Copilot acts as **Tier C — Execution Workforce** in this repository. +> Implement well-specified issues, open draft PRs, never merge or approve. + +## Project Overview + +**LLMint** is the token economics middleware for the Chitin platform. It tracks LLM costs, enforces budget rules, and enables model cascading. Octi Pulpo imports LLMint for dispatch budget gating. + +**Core principle**: Every token has a cost. LLMint makes that cost visible and enforceable. + +## Tech Stack + +- **Languages**: Go + Python +- **Go module**: `github.com/chitinhq/llmint` +- **Version**: v0.1.0 (semver — breaking changes require major bump) + +## Repository Structure + +``` +cmd/llmint/ # Go binary entrypoint +internal/ +├── tracker/ # Cost tracking per request/session +├── budget/ # Budget rules and enforcement +├── cascade/ # Model cascading logic (Haiku → Sonnet → Opus) +└── config/ # Configuration +llmint/ # Python package (analytics, cost reporting) +``` + +## Build & Test + +```bash +# Go +go build ./... +go test ./... +golangci-lint run + +# Python +python -m pytest tests/ +``` + +## Coding Standards + +- Follow Go conventions (`gofmt`, `go vet`) +- Python: follow existing style, type hints preferred +- Error handling: always check and wrap errors with context +- This is a published module — API stability matters, semver is enforced + +## Governance Rules + +### DENY +- `git push` to main — always use feature branches +- `git force-push` — never rewrite shared history +- Write to `.env`, SSH keys, credentials +- Write or delete `.claude/` files +- Execute `rm -rf` or destructive shell commands + +### ALWAYS +- Create feature branches: `agent//issue-` +- Run `go build ./... && go test ./...` before creating PRs +- Include governance report in PR body +- Link PRs to issues (`Closes #N`) + +## Three-Tier Model + +- **Tier A — Architect** (Claude Opus): Sprint planning, architecture, risk +- **Tier B — Senior** (@claude on GitHub): Complex implementation, code review +- **Tier C — Execution** (Copilot): Implement specified issues, open draft PRs + +### PR Rules + +- **NEVER merge PRs** — only Tier B or humans merge +- **NEVER approve PRs** — post first-pass review comments only +- Max 300 lines changed per PR (soft limit) +- Always open as **draft PR** first +- If ambiguous, label `needs-spec` and stop + +## Critical Areas + +- `internal/budget/` — budget enforcement, cost impact on all dispatch +- `internal/cascade/` — model selection, affects token spend +- Public Go API surface — semver, don't break consumers + +## Branch Naming + +``` +agent/feat/issue- +agent/fix/issue- +agent/refactor/issue- +agent/test/issue- +agent/docs/issue- +``` + +## Autonomy Directive + +- **NEVER pause to ask for clarification** — make your best judgment +- If the issue is ambiguous, label it `needs-spec` and stop +- Default to the **safest option** in every ambiguous situation diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml new file mode 100644 index 0000000..cb634f1 --- /dev/null +++ b/.github/workflows/claude.yml @@ -0,0 +1,20 @@ +name: Claude Code +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + pull_request: + types: [opened, synchronize] +jobs: + claude: + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request' && github.event.pull_request.user.login == 'copilot-swe-agent[bot]') + runs-on: ubuntu-latest + steps: + - uses: anthropics/claude-code-action@v1 + with: + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + claude_args: "--model claude-sonnet-4-6 --max-turns 10" diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..d5fa556 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,36 @@ +## Agent Identity + +At session start, if you see `[AgentGuard] No agent identity set`, ask the user: +1. **Role**: developer / reviewer / ops / security / planner +2. **Driver**: human / claude-code / copilot / ci + +Then run: `scripts/write-persona.sh ` + +## Project + +LLMint is the token economics middleware for the Chitin platform. It tracks LLM costs, enforces budget rules, and enables model cascading (Haiku → Sonnet → Opus). + +**Module**: `github.com/chitinhq/llmint` +**Languages**: Go + Python +**Version**: v0.1.0 (semver enforced) + +## Key Directories + +- `cmd/llmint/` — binary entrypoint +- `internal/tracker/` — cost tracking per request/session +- `internal/budget/` — budget rules and enforcement (cost impact, careful) +- `internal/cascade/` — model cascading logic +- `llmint/` — Python package for analytics + +## Build + +```bash +go build ./... +go test ./... +golangci-lint run +python -m pytest tests/ +``` + +## Assembly Line + +LLMint is imported by Octi Pulpo for dispatch budget gating. Every agent task has a cost budget in its work contract — LLMint enforces it. From d854fe3ef0f89cfb0d290b739e5de2f6611b45dd Mon Sep 17 00:00:00 2001 From: Jared Pleva Date: Mon, 6 Apr 2026 02:26:22 +0000 Subject: [PATCH 2/2] fix: use official claude-code-action template with OAuth token Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/claude-code-review.yml | 29 ++++++++++++++++++++++ .github/workflows/claude.yml | 31 +++++++++++++++++++----- 2 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/claude-code-review.yml diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml new file mode 100644 index 0000000..5490034 --- /dev/null +++ b/.github/workflows/claude-code-review.yml @@ -0,0 +1,29 @@ +name: Claude Code Review + +on: + pull_request: + types: [opened, synchronize, ready_for_review, reopened] + +jobs: + claude-review: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + issues: read + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run Claude Code Review + id: claude-review + uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + plugin_marketplaces: 'https://github.com/anthropics/claude-code.git' + plugins: 'code-review@claude-code-plugins' + prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}' diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index cb634f1..efed325 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -1,20 +1,39 @@ name: Claude Code + on: issue_comment: types: [created] pull_request_review_comment: types: [created] - pull_request: - types: [opened, synchronize] + issues: + types: [opened, assigned] + pull_request_review: + types: [submitted] + jobs: claude: if: | (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || - (github.event_name == 'pull_request' && github.event.pull_request.user.login == 'copilot-swe-agent[bot]') + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || + (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + issues: read + id-token: write + actions: read steps: - - uses: anthropics/claude-code-action@v1 + - name: Checkout repository + uses: actions/checkout@v4 with: - anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} - claude_args: "--model claude-sonnet-4-6 --max-turns 10" + fetch-depth: 1 + + - name: Run Claude Code + id: claude + uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + additional_permissions: | + actions: read