Skip to content

About

My AI-SDLC harness framework development

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

19 Commits

Folders and files

Repository files navigation

Agentic SDLC harness

One role, one step, one artifact, one PR. Seven role agents (PO, BA, SA, TL, QE-1, Dev, QE-2) take a PBI from a GitHub Issue to a feature on develop. Humans decide only at PR gates. Hooks and CI enforce the rules. Every action goes into a hash-chained audit log. The design is in docs/plan.md.

PBI (label: ready) ─▶ [PO] product.md ─▶ [BA] requirements.md ─▶ [SA] solution.md ─▶ [TL] plan.md
                   ─▶ [QE-1] test-spec.md ─▶ [Dev] feature/<pbi>-<task> ─▶ [QE-2] quality-report.md
each arrow = human merge ─▶ entry gate (E1–E8) ─▶ role agent ─▶ exit validators ─▶ PR

Layout

Path What
.claude-plugin/ Claude Code plugin and marketplace manifests
agents/ One agent per role (sdlc-harness:po ... sdlc-harness:qe2)
skills/ Shared skills: pbi, open-question, pr-description, self-check, diagram, commit-style, trace-ids
hooks/hooks.json Governance hooks → harness/hooks/*.py
harness/harness.yaml Defaults. A repo overrides them in harness-overrides.yaml
harness/gates/gate.py Gate CLI: entry, exit, pr, ci, scope, stamp, stale, next, config-check, doctor
harness/validators/ Deterministic validators (template, STE, budgets, questions, Gherkin, ISO 29148/25010, 4+1, ASVS, trace, diagrams, commits, PR)
harness/templates/, harness/instructions/ Artifact templates and the instruction catalog (section 7)
harness/adapters/ PBI adapter contract + GitHub adapter (pbi.py CLI)
harness/audit/ Audit log with hash chain, publish.py, append-only check
harness/runner.py Step runner (harness CLI): run, gate, prepare, agent, finish, status, next
harness/runner_stages.py The stages of one step. The runner and CI both call them
harness/ci/steps.py CI only: config, route (+ v1.1.0 aliases)
.github/workflows/ Reusable run-role.yml and validate.yml; ci.yml for this repo
examples/ Files to copy into the specs, code and audit repos

Use it locally

Python 3.11+ and PyYAML.

pip install pyyaml pytest
python harness/gates/gate.py config-check                         # check harness.yaml + overrides
python -m pytest                                                  # the harness test suite

# from a specs repo folder
python /path/to/harness/harness/gates/gate.py entry --role sa --pbi 123            # needs GitHub for E3/E7/E8
python /path/to/harness/harness/gates/gate.py entry --role sa --pbi 123 --offline  # E3/E7/E8 SKIPPED, never PASS
python /path/to/harness/harness/gates/gate.py exit  --role sa --pbi 123            # exit validators on your work tree
python /path/to/harness/harness/gates/gate.py doctor                               # check the GitHub setup

Exit codes: 0 ready or pass, 1 not ready or fail, 2 config or usage error.

harness.yaml can use variables: $NAME, ${NAME}, ${NAME:-default} ($$ is a literal $). Values come from, highest first: the environment, <repo>/.env, harness/.env. Copy harness/.env.example to harness/.env for local runs. In consumer repos, literal values in harness-overrides.yaml replace the variables before they are resolved. An undefined variable stops the load with exit code 2.

Run a role step: harness

One command runs one role step for one PBI, the same stages CI runs (run-role.yml calls them too):

harness run --role po --pbi 1
  gate ──────▶ prepare ─────────▶ agent ─────────────▶ finish
  E1–E8        spec/<pbi>/<role>   claude -p, the role   stamp, exit gate, commit,
  waiting if   branch, PBI,        agent, hooks on,      scope check, push, PR,
  not ready    status in progress  live log              status in review
pip install -e /path/to/ai-sdlc-harness          # gives the `harness` command (or: python harness/runner.py)
cd /path/to/specs-repo                            # run from the specs repo
harness next   --pbi 1                            # which roles can run now
harness run    --role po --pbi 1                  # one step, end to end, PR opened
harness run    --role po --pbi 1 --no-pr          # stop after the local commit
harness run    --role po --pbi 1 --interactive    # watch and step in: a Claude session with the prompt sent
harness run    --role dev --pbi 1 --task T-01 --code-dir ../code-repo
harness respond --pr 7                            # the role agent answers the open review comments on PR #7
harness respond --pr 4 --code                     # the same for a task PR in the code repo
harness status --pbi 1                            # artifact, status, PR and gate for every role
harness clean                                     # remove kept worktrees of finished runs

Git is the runner's job. The instruction instructions.workspace in harness.yaml chooses how:

workspace What a local run does
worktree (default) Never switches your clone or touches your changes. Works in its own worktrees under instructions.workspace_dir (~/.harness/work/<run_id>/), made from origin.
in-place Stops if your clone has uncommitted changes. Switches it to the work branch, runs, then switches back (also after a failed run; its leftover files go to a named stash).

CI always works in its fresh checkout. With worktree:

Role specs/ worktree code/ worktree
po, ba, sa, tl, qe1, qe2 branch spec/<pbi>/<role> from origin/main sa, qe2: origin/develop, read only
dev origin/main, read only branch feature/<pbi>-<task> from origin/develop
review run (respond) from the PR branch dev: from the PR branch

After the PR, the worktrees are removed. The work branch stays in your clone (git switch spec/1/po to look). With --no-pr or when a human is needed, the worktree is kept and the summary prints its path. A new run of the same step replaces it. If you have the work branch checked out yourself, the run works detached and still pushes the branch. In CI the fresh checkouts are used in place.

The agent answers its reviewers. Every human review or comment on a harness PR (spec/<pbi>/<role>, feature/<pbi>-<task>) starts a review run of the role that opened it. In CI the specs repo routes pull_request_review and issue_comment events; the code repo forwards its reviews with a harness-review dispatch. Locally, run harness respond --pr <n>.

review / comment ─▶ prepare ──────────────────▶ agent (review-reply skill) ─▶ finish
                    open items → .harness/      change the outputs where the   replies check, commit and
                    review.md + review.json     reviewer is right; one reply   push if changed, post one
                    none: stop, no agent        per item → replies.json        reply per item, in thread
  • Open items: unresolved threads whose last comment is by a person, and PR comments or review bodies with no harness reply yet. Approvals, bots and the harness's own replies (marked <!-- harness:reply-to:… -->) never count.
  • Each reply has an action: changed (with the commit), answered, declined (reason and one fact) or question. It has 5 lines or fewer and follows STE (gate.py replies checks it; so do the Stop hook and finish).
  • The agent never posts, resolves threads or gets a token. The runner posts after the push.
  • review.max_agent_rounds (default 5) stops a long discussion: needs-human and one PR comment. review.discussion: false starts a run on "changes requested" only.

Run the stages one by one to see each part. Without --run-id, a stage continues the latest unfinished run of that role and PBI:

harness gate    --role po --pbi 1                 # starts a run, prints its id
harness prepare --role po --pbi 1
harness agent   --role po --pbi 1 [--interactive]
harness finish  --role po --pbi 1 [--no-pr]
  • One run is one audit folder: ~/.harness/audit/<run_id>/ (runner.json, gate.json, events.jsonl, claude-output.jsonl). The hooks write into the same folder. The summary checks the hash chain.
  • GitHub access uses GITHUB_TOKEN, GH_TOKEN or gh auth token. The agent never gets a token (P4).
  • The headless agent runs with --permission-mode bypassPermissions, as in CI. The hooks still block writes outside the role's outputs, gh, push, merge and secret reads.

Exit codes: 0 done, 1 not ready or needs a human, 2 usage or setup error.

Agents only on your machine (runner.agent_runs: local). By default CI starts the role agents (ci) and pays for the LLM API. Set runner.agent_runs: local in harness-overrides.yaml to stop that. CI still runs the validators, routes each event and marks stale specs, but it starts no agent. The CI run summary of the route job lists the command to run instead, for example harness run --role ba --pbi 1 or harness respond --pr 9. harness next and harness status show the same work from your machine.

Claude Code without the runner

claude --plugin-dir "$HARNESS_HOME"               # human session: hooks log and block merges, pushes, secrets

Without HARNESS_ROLE (a human session), the hooks only log and block merges, force pushes, protected-branch pushes, secret reads and audit-folder access. Use harness run for a role step: a bare claude --agent sdlc-harness:<role> has no prompt and no run context.

Set up an organization (plan section 5.1)

  1. Create the GitHub App with the permissions in section 5.1. Install it on the issue, specs, code and harness repos (the workflows clone the harness with it).
  2. Add org secrets HARNESS_APP_ID, HARNESS_APP_PRIVATE_KEY, ANTHROPIC_API_KEY. Set the private keys from the .pem file, not by pasting into the web form. A pasted key often loses its line breaks, and every run then stops with Invalid keyData:
    gh secret set HARNESS_APP_PRIVATE_KEY --org <org> --visibility selected --repos <specs>,<code> < harness-app.pem
    gh secret set HARNESS_AUDIT_APP_PRIVATE_KEY --org <org> --visibility selected --repos <specs> < audit-app.pem
    
    doctor sees only the secret names. When a key is wrong, the workflow step after the App token says which secret to set again.
  3. Rulesets on main, develop, release/*, hotfix/*: PR, human approval, green checks. The App is not a bypass actor.
  4. Add the Project Status options from pbi.github.project.status_map.
  5. Create the audit repo and the harness-audit App (Contents: write on that repo only). Add HARNESS_AUDIT_APP_ID, HARNESS_AUDIT_APP_PRIVATE_KEY. Copy examples/audit-repo/.
  6. Copy examples/specs-repo/ and examples/code-repo/ into those repos. Replace <org> and the repo names.
  7. Tag this repo (v1.1.0) and pin that tag in every uses: and harness_ref.
  8. Run python harness/gates/gate.py doctor from the specs repo. It also checks that the specs and code repos can call the harness workflows. If the harness repo is private, set Settings → Actions → General → Access to "Accessible from repositories in the organization". Otherwise every run fails as a "workflow file issue" and no job starts. In the code repo, make develop the default branch: GitHub runs PR comment triggers with the default branch's workflow. It lists the secrets each repo needs and FAILs on a missing one (names only, never values).

If the issue repo is not the specs repo, send repository_dispatch type harness-pbi-ready with client_payload.pbi from the issue repo when the ready label is added.

What the agent can and cannot do

Rule Where it is enforced
Write only roles.<role>.outputs + .harness/pr-description.md PreToolUse path guard; gate.py scope in CI
No merge, no push, no gh, no secrets, no audit folder, network allow-list PreToolUse; no token in the agent step; persist-credentials: false
Conventional commits ≤ 300 lines / 10 files on feature/<pbi>-<task> PreToolUse commit + branch guard; commits validator
Artifacts pass their validators, 3 tries, then needs-human Stop hook; finish step; validate.yml
Front matter facts (upstream, status, decisions defaults) Written by the harness (gate.py stamp), not the agent
Humans merge Rulesets; the App is not a bypass actor
Sees only the harness: no personal settings, skills, MCP servers or connectors, no ~/AGENTS.md; uses the harness skills (Skill tool) harness starts claude with --setting-sources project,local --strict-mcp-config; the same in CI

Status

Phase State
1. Foundation Built. Tested offline (pytest). Still to prove on GitHub: plugin loads headless (ci.yml → plugin-smoke), diagram render step.
2–4. Roles Agents, templates and validators are in place. Needs real PBIs to tune.
5. Evaluation Not started. The audit record has the fields it needs.
6. Jira, Azure DevOps Adapter contract only (NotBuiltYet).

About

My AI-SDLC harness framework development

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages