Skip to content

About

AI-DLC Lean: a lightweight AI-DLC workflow kit for Kiro CLI (v3). Same stages and aidlc-docs/ layout as AI-DLC, three human approvals (requirements, design, release), a hash-chained audit log and verify-before-commit, with optional Ideation and Operations phases. Sample code, not for production use.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

AI-DLC Lean

English | 中文

A lightweight version of AI-DLC (awslabs/aidlc-workflows) for Kiro CLI (v3 engine). Version 0.3.2 (0.3.1 plus lean use --none, see "Commands"; 0.3.1 is fixes only, see the design notes §10).

Disclaimer: This is sample code, for demonstration and learning only. It is not ready for production use as is. Before you use it in production, review, test and harden it yourself against your organization's security and quality requirements. It is not the official AWS AI-DLC, and it is not an AWS-supported product.

It keeps the shape of AI-DLC:

  • The stages follow AI-DLC's order and names;
  • The file names and folders also follow AI-DLC (aidlc-docs/, aidlc-state.md, requirements.md …);
  • What each step did is recorded;
  • It is traceable: acceptance criteria map all the way to tests.

It drops the heavy parts:

  • People approve in only 3 places: requirements, design (these two can be approved at once), and release. In regulated mode, each unit's code plan is approved too; with the Ideation phase, there is one more approval, IDEATION, at the start;
  • No more one question file per stage: all questions are asked once, at the start;
  • No role-play;
  • One page per document.

v0.3 adds back two parts of AI-DLC. Both are optional and off by default:

  • Ideation (7 stages): for product managers, from an idea to an approved initiative brief. Turn it on with lean new <name> --ideation; at the end a person approves IDEATION once;
  • Deployment and Operations (Operations, 7 stages), plus the CI pipeline stage (ci-pipeline) in Construction: these pages can be written before or after release. The rule is the AI writes only documents and config; it does not deploy. Deployment is left to the team's own CI/CD. This is a rule written for the AI; the tool cannot guarantee it (see 1a).

It still works for regulated, multi-team and multi-day projects.

When to use Lean:

  • For small, clear requests, use Kiro directly, without Lean: the process itself costs extra time and credits, and on small requests it does not buy a better result.
  • Use Lean for requests with gaps, work across teams, or regulated work.

Footprint:

  • Always-on instructions per turn: 999 words (144 more with the pstack pack).
  • Code: one Python script, 4,507 lines, standard library only.

Design notes: docs/design-v0.2.md.

Read this first: guardrails, not a security boundary

  • Lean's gates are guardrails: they guard against the AI cutting corners, skipping steps or taking shortcuts.
  • They are not a security boundary. When the AI can run commands (it has a shell), it can still get around some of these checks.
  • The real controls for regulated projects are on the Git server: GitLab protected branches, MR (merge request) approvals, signed commits.
  • lean verify runs the commands listed in checks in aidlc-docs/lean.json through the shell, like running a repository's Makefile or CI script. In a repository you did not write, read its lean.json before you or the AI run lean verify.

What Lean keeps from AI-DLC

1. Stages: AI-DLC's order and names

One piece of work is called an intent, and each intent has one folder: aidlc-docs/<date>-<name>/, for example aidlc-docs/261108-refunds/. The files in the table below are all in this folder.

<unit> is the unit name. A unit is a piece of code that can be delivered on its own, such as api or web. Without a unit split there is only one unit, called app.

# Stage (AI-DLC name) id in commands File Can it be skipped? Human approval
1 Reverse Engineering reverse-engineering inception/reverse-engineering/architecture.md Yes (new project) –
2 Requirements Analysis requirements inception/requirements/requirements.md No REQUIREMENTS (or INCEPTION)
3 User Stories user-stories inception/user-stories/stories.md Yes –
4 Application Design application-design inception/application-design/application-design.md Only when the requirements page says Size: small DESIGN (or INCEPTION)
5 Units Generation units inception/application-design/unit-of-work.md Yes (when there is only one unit) –
6 Functional Design (per unit) functional-design construction/<unit>/functional-design/functional-design.md Yes –
7 NFR Requirements + Design (per unit) nfr-design construction/<unit>/nfr-design/nfr-design.md Yes –
8 Infrastructure Design (per unit) infrastructure-design construction/<unit>/infrastructure-design/infrastructure-design.md Yes –
9 Code Generation (per unit) code-generation construction/plans/<unit>-code-generation-plan.md, then the code No Regulated mode only: PLAN
10 Build and Test build-and-test construction/build-and-test/build-and-test-summary.md (written by the tool) No – (stops only on failure)
11 CI Pipeline (v0.3, optional, see 1a) ci-pipeline construction/ci-pipeline/ci-config.md Yes –
12 Release release operations/release.md (written by the tool; the AI fills in Open items) No RELEASE
  • 1-5 belong to Inception (work out what to build and why), 6-11 to Construction (how to build it), and 12 is a phase of its own, Release (its file is under operations/). The optional Ideation phase comes before 1, and the Operations phase after 12 (see 1a).
  • 6-9 are done one unit at a time: finish one unit's design, plan and code before starting the next.
  • Skipping a stage needs a reason: lean stage skip <id> --reason "..."; the reason is recorded. The notes in brackets in the table are common cases for skipping; whether to skip is the AI's call, following the rules. The tool checks only these: requirements, code generation, build and test, and release cannot be skipped; application design can be skipped only when the requirements page says Size: small; with Ideation, the 3 stages Intent Capture, Scope Definition and Approval Handoff cannot be skipped; after release, only the Operations stages and ci-pipeline can still be skipped; no skip without a reason.
  • Differences from AI-DLC v1 (aidlc-workflows 1.0.1):
    • Workspace Detection and Workflow Planning are not separate stages; they are folded into "read the code first" and "a skip needs a reason";
    • NFR Requirements and NFR Design are merged into one page;
    • There is one extra level, the intent folder (v1 puts the files directly under aidlc-docs/);
    • v1's Operations is still an empty placeholder; here there is a separate Release phase: write the release record, and a person approves the release. v0.3 also has the optional Ideation and Operations phases (see the next section); the Operations phase also only writes documents and config, and does not deploy.

1a. Two optional phases: Ideation, Deployment and Operations (v0.3)

The stage ids follow AI-DLC main (d12d620): its 7 Ideation stages, its 7 Operations stages, and the CI pipeline stage in Construction. The display names are shorter and not all the same as in main: for example main's Intent Capture & Framing, Feasibility & Constraints, Approval & Handoff and Feedback & Optimization are called Intent Capture, Feasibility, Approval Handoff and Feedback Optimization here. Each stage has one page, and most file names are the name of that stage's main artifact in AI-DLC main; market-research.md and observability.md are names Lean chose (main splits them into several files, such as competitive-analysis.md, dashboards.md and alarms.md).

Ideation: for product managers (PMs). The PM answers the questions, reads each page and types the approval line themselves; the AI asks the questions, drafts the pages and runs lean. Skill: aidlc-lean-ideation.

Stage id in commands File Can it be skipped?
Intent Capture intent-capture ideation/intent-capture/intent-statement.md (problem, customers, success metrics, why now, stakeholders) Not when Ideation is used
Market Research market-research ideation/market-research/market-research.md (alternatives, trends, build or buy) Yes
Feasibility feasibility ideation/feasibility/feasibility-assessment.md (constraints, RAID) Yes
Scope Definition scope-definition ideation/scope-definition/scope-document.md (in scope, out of scope, ordered backlog) Not when Ideation is used
Team Formation team-formation ideation/team-formation/team-assessment.md (staffing, skill gaps, RACI) Yes
Rough Mockups rough-mockups ideation/rough-mockups/wireframes.md (user flows, text sketches or links) Yes
Approval Handoff approval-handoff ideation/approval-handoff/initiative-brief.md (initiative brief, go/no-go recommendation, decision record) Not when Ideation is used; human approval IDEATION
  • How to turn it on: lean new <name> --ideation (--ideation can also come before the name); it starts at Intent Capture. Without --ideation, the whole phase is recorded as skipped (reason "not requested (lean new without --ideation)"), and the developer flow is the same as in v0.2. Before the requirements are approved, lean stage start intent-capture (or another Ideation stage) can still reopen it. Once it is reopened, earlier skips of the 3 stages Intent Capture, Scope Definition and Approval Handoff no longer count: they have to be written and then recorded with lean stage done.
  • How to skip: lean stage skip ideation --reason "..." skips, in one go, the Ideation stages that have no record yet (neither done nor skipped). Once IDEATION has been requested (whether it is still waiting, approved or rejected), the whole phase can no longer be skipped; a person decides.
  • IDEATION approval: when the brief is written, run lean stage done approval-handoff, then lean request IDEATION. The approval line is given only when the 3 stages Intent Capture, Scope Definition and Approval Handoff are all recorded as done with lean stage done (the pages alone do not count); an approve IDEATION typed by a person also counts only then. If one of these 3 stages is started again with stage start after the request, the approval line is withdrawn (stage progress gives no approval line; for example the Approval Handoff line says "IDEATION also needs Scope Definition done", and Next says "finish "), and it comes back after that stage's stage done. One hash covers all Ideation pages (the ones that exist, in stage order); if a page is changed, added or deleted later, the approval goes stale and must be given again. With Ideation, while IDEATION is not approved (or is rejected): the requirements and INCEPTION cannot be approved, code cannot be written (gate ideation), and lean release refuses too. If it was approved and then changed (stale), standard mode still lets you approve the requirements and write code (lean status marks it as stale), while regulated mode blocks both; release, in either mode, requires it to match the current files: lean release, lean request RELEASE and the RELEASE approval all refuse. approvers can let only the PM approve IDEATION, for example "approvers": {"IDEATION": ["pm@example.com"]}.
  • After IDEATION has been requested (waiting, approved or rejected): Next in lean status no longer offers the optional Ideation stages that were never started, because a new page voids the request and makes the approval stale. Stages already started are still finished first, even after approval (Next before release points to them). If it went stale, request it again; if it was rejected, change the pages as the person said and request again. If stage start approval-handoff was run again while making the changes, stage done approval-handoff must come first before request IDEATION gives an approval line.
  • After approval, the development team picks up Inception from the brief: the goals, out-of-scope items and acceptance criteria of the requirements come from the Ideation pages, and only the questions Ideation did not answer are asked.

CI pipeline and Operations: skill aidlc-lean-operations.

Stage id in commands File When
CI Pipeline (Construction, after Build and Test) ci-pipeline construction/ci-pipeline/ci-config.md (CI steps, quality gates, artifacts) CI is new or needs changes
Deployment Pipeline deployment-pipeline operations/deployment-pipeline/deployment-strategy.md (CD config, release strategy, environment promotion, rollback steps) The release method is new or needs changes
Environment Provisioning environment-provisioning operations/environment-provisioning/environment-inventory.md Environments changed
Deployment Execution deployment-execution operations/deployment-execution/deployment-log.md (version, environment, time, smoke tests, health checks, result) After the team's pipeline has actually deployed
Observability Setup observability-setup operations/observability-setup/observability.md (logs, metrics, dashboards, alarms, SLOs) Monitoring changed
Incident Response incident-response operations/incident-response/runbooks.md (steps for each alarm, escalation paths) On-call needs steps
Performance Validation performance-validation operations/performance-validation/load-test-plan.md (plan first, then the results, against the NFR targets) A target needs a load test to prove it
Feedback Optimization feedback-optimization operations/feedback-optimization/feedback-loop.md (SLO results, cost, follow-up intents) A few weeks after go-live
  • The AI does not deploy: the AI writes documents and config; deploys, building environments, rollbacks and load tests against shared environments are done by the team's CI/CD (for example GitLab, then Argo CD) or by people. This is a rule the always-on instructions and the skills give the AI; the tool cannot guarantee it. The deny list (gate danger) is only a very short default list, with a few entries such as terraform apply and kubectl apply, and it cannot stop every deploy command; people add the team's own deploy commands to deny_commands in aidlc-docs/lean.json. What really controls deploys is the team's pipelines and permissions, for example the account the AI runs commands with has no deploy permission (the same as "guardrails, not a security boundary" above). The deployment log is filled in only after a real deploy, from the facts given by the pipeline and the person who watched the deploy.
  • Config is code: CI files, K8s manifests, Helm values, IaC, and alarms and dashboards written as code are all product files: the gates for writing code apply to them, and after changing them you run lean verify again. The pages in aidlc-docs/ are only records.
  • Written before or after release: optional in every mode. Before release, write the planning pages (CI, deployment pipeline, environments, observability, incident response, load-test plan), commit and verify the config, then run lean release. The RELEASE hash covers only release.md: it holds the commit, the code fingerprint, the verify result, the approvals table, Open items, and the stage progress at the moment of lean release (whether each Operations stage was done, skipped or not started then); the content of the Operations pages themselves is not in it. So changing or adding Operations pages after approval does not void RELEASE; these pages are only records. But stage records (stage start/done/skip, including skipping the whole Operations phase) made between lean release and the RELEASE approval void release.md, the same as a missing approval: run lean release again and request again (v0.3.1; compared by the records in the ledger, not by time). So record the Operations stages either before lean release or after RELEASE is approved. Operations config files count toward the code fingerprint: if they change after lean release, verify, lean release and approve again. RELEASE does not wait for the Operations pages either. After release, only the Operations stages and ci-pipeline still accept stage commands, and the intent stays released; Next in lean status shows "optional: record deployment and operations ...", only as a hint.
  • After release, only pages: to change product config (CI or deploy jobs, manifests, alarm thresholds), open a new intent. In standard mode a small change can be made directly, but say what was changed in the stage note (--note), then run lean verify (this verify is recorded in the ledger, but does not count toward the stage log of the released intent). In regulated mode, always open a new intent.
  • How to skip: lean stage skip operations --reason "..." skips, in one go, the Operations stages that have no record yet (not ci-pipeline); ci-pipeline is skipped on its own: lean stage skip ci-pipeline --reason "...".

Order of the stage progress list: 7 Ideation, 5 Inception, Construction (4 per unit, then Build and Test, CI Pipeline), Release, 7 Operations. 26 stages in total (the 4 per-unit stages counted once). When a phase is skipped as a whole in one go, it shows as one line, for example - [S] Ideation — skipped: not requested (lean new without --ideation), - [S] Operations — skipped: platform team deploys.

Differences from AI-DLC main:

  • main has several files per stage, plus a question file, and asks a person to approve after each stage; here each stage has one page, Ideation is approved once, IDEATION, at handoff, and Operations has no approval;
  • in main, the AI pushes the pipeline and runs smoke tests and database migrations in Deployment Execution, applies IaC in the environment stage, and runs load tests in the performance stage; here all of these are done by the team's pipelines or by people, and the AI writes only plans and records;
  • main's operations folder is called operation/; here Lean keeps its existing operations/ (release.md is in it too);
  • main has no Release step; here the release approval sits between Construction and Operations.

2. Three approval points

  1. Requirements: approve REQUIREMENTS <hash>
  2. Design: approve DESIGN <hash>. Requirements and design can be approved together: approve INCEPTION <hash>, one hash covering both pages.
  3. Release: approve RELEASE <hash>

Three more kinds:

  • Ideation (only when the Ideation stages are used): approve IDEATION <hash>, one hash covering all Ideation pages; it must be approved before the requirements (see 1a).
  • Regulated mode: each unit's code plan is approved once, approve PLAN <hash>. The hash tells which unit's plan it is: when an intent has two or more plans, a PLAN approval must include the hash (in standard mode too). An approved plan can still have its steps ticked (- [x]), and the approval stays valid; changing a step's text, or adding or removing steps, needs a new approval.
  • Multi-team: changing another team's contract needs someone from that team to approve a CR (change request), approve CR-<team>-<n> <hash>. An approved CR lets through only the team that requested it, and only until the CR is closed (lean cr close <id> --reason "...", closed after the other team has changed the contract).

The AI prints the approval line by running lean request ..., for example:

Ask the human to read aidlc-docs/261108-refunds/inception/requirements/requirements.md and aidlc-docs/261108-refunds/inception/application-design/application-design.md and, if they agree, type exactly:

    approve INCEPTION 8cf2cbce

or `reject INCEPTION <reason>`. Any later change to either file voids the approval.

Rules:

  • You must type this line yourself, on a line of its own, for it to count as approval. "Looks fine, go ahead" does not count; nor does anything the AI says. Kiro messages that Lean recognises as the host's (starting with [SYSTEM] or A workflow you launched, or containing <original_user_request>) do not count either; other text Kiro sends through the prompt hook would be read as the human's.
  • The task description a subagent receives does not count either. When Kiro 3.1.0 starts a subagent, it fires the session-start and prompt hooks again with the main conversation's session id; Lean matches such a task description, by its text, to the subagent call the AI made, records it separately, does not treat it as a human message, and does not accept approval lines in it. A task description it cannot match that way counts as a human message.
  • When an approval line is not accepted (for example no hash, a hash that does not match, an approver not on the allow-list, or RELEASE while lean release would not pass now), the ledger records an APPROVAL_REFUSED with the reason; it also shows in audit.md.
  • Chinese also works: 批准 INCEPTION 8cf2cbce, 同意 INCEPTION 8cf2cbce (approve). To disagree, type reject INCEPTION <reason> (or 驳回, 拒绝, which mean reject).
  • The hash is a fingerprint of the file content (the first 8 characters of its sha256). If the file changes after approval, the approval is void. Code plans are the exception: when the hash is computed, check boxes [x] and [X] after a leading - or * count as [ ], so ticking steps is not a change.
  • Regulated mode requires the hash; in standard mode an approval without it also counts, and approves the file as it was at that moment.
  • Any line in your message that is exactly this line, on its own, counts as approval. So do not paste the output of lean request or the AI's reply back to ask a question.

3. What each step did: aidlc-state.md

After each stage, the AI runs lean stage done <id> --note "what was used, what was produced, key decisions". The tool writes it into the audit ledger, then regenerates the part of aidlc-state.md between the two markers. The Session notes (handoff notes) below the markers belong to the AI.

A real example (from a scripted simulated run on 2026-11-08; only 4 entries of the stage log are kept):

# AI-DLC State: Refunds within 14 days
Intent: 261108-refunds · Mode: standard · Created: 2026-11-08
<!-- lean:begin progress -->
## Stage progress
- [x] Reverse Engineering — done · 2026-11-08
- [x] Requirements Analysis — approved via INCEPTION (sha 8cf2cbce) · 2026-11-08
- [S] User Stories — skipped: one persona (buyer), one action
- [x] Application Design — approved via INCEPTION (sha 8cf2cbce) · 2026-11-08
- [S] Units Generation — skipped: one unit: a single Python package
- [x] Functional Design (app) — done · 2026-11-08
- [S] NFR Requirements + Design (app) — skipped: no new NFR targets
- [S] Infrastructure Design (app) — skipped: in-process library, no infrastructure
- [x] Code Generation (app) — done · 2026-11-08
- [x] Build and Test — verify PASS · 2026-11-08 04:15 UTC (code fingerprint 99bff36f)
- [x] Release — released: approved (sha dedf0bf7) · 2026-11-08

## Stage log

### Requirements Analysis · 2026-11-08 04:15 UTC · by dev@example.com (team -)
- Did: Inputs: request, 3 answers, architecture.md. Output: Size large, AC-1..3, A-1.
- Outputs: inception/requirements/requirements.md (sha 64d5b2f5)

### User Stories · 2026-11-08 04:15 UTC · by dev@example.com (team -)
- Skipped: one persona (buyer), one action

### Code Generation (app) · 2026-11-08 04:15 UTC · by dev@example.com (team -)
- Did: Inputs: plan, BR-1/BR-2. Output: src/refunds.py, tests/test_refunds.py (AC-1..3).
- Outputs: construction/plans/app-code-generation-plan.md (sha 26f12321)

### Build and Test · 2026-11-08 04:15 UTC · by dev@example.com (team -)
- Did: verify PASS: 1 check on code fingerprint 99bff36f
- Outputs: construction/build-and-test/build-and-test-summary.md (sha 5294818b)
<!-- lean:end progress -->
## Session notes
Status: released (RELEASE approved)
### Next
### Open questions and blockers
### Notes for the next session
  • The example above is from v0.2. The v0.3 list has a few more lines: without Ideation, an extra first line - [S] Ideation — skipped: not requested (lean new without --ideation); one more line, CI Pipeline, after Build and Test; and 7 more Operations lines after Release, or a single line - [S] Operations — skipped: <reason> when the whole phase is skipped. Each Stage log header now also ends with who recorded it ( · via CLI for these four).
  • Marks: [x] done, [S] skipped, [-] in progress, [ ] not started, [A] waiting for human approval (the approval line has been printed, not yet approved). A line waiting for approval looks like this: - [A] Requirements Analysis — waiting for approval: approve INCEPTION 8cf2cbce. A request whose approval line would not be accepted even if the person typed it now gets no approval line, and shows as [-] ... <kind> requested; the approval waits: <reason>. For example: a requirements request while Ideation is used and IDEATION is not yet approved; a RELEASE request while lean release would not pass now. After IDEATION is requested, reopening a required Ideation stage also gives no approval line (see 1a); after lean release, if another approval or a stage record is recorded, RELEASE gives no approval line either (see "Commands").
  • The part between the markers goes into git, so it looks only at what is the same in every clone (the audit ledger and the files), not at this clone's own state: the same commit and the same ledger give the same text in any clone. For example, a clone that has checks configured but has not run verify itself still writes [A] Release — waiting for approval: approve RELEASE <hash>; but typing that line in that clone does not count (there is no verify that passed on the current code), and its lean status tells you to run verify first. The Build and Test and Release lines accept two versions of the code: the one in this clone's working tree, and the committed one. So if you commit right after verify, this part in the commit says verify passed; and if a clone has extra uncommitted files (such as Finder's .DS_Store) or changes, this part does not change either. When the working tree has uncommitted product changes, lean status adds a separate line outside this part, Working tree: N uncommitted product change(s) (…), because verify and the RELEASE approval look only at the working tree (the commit gate looks at what this commit carries; see step 6 below).
  • Approvals, rejections and verify results show up in the list automatically. The stage log also lists each approval, rejection and refused approval line (kind, hash, who, when). Each stage log entry states its source: what a person typed in the conversation is marked human (prompt), and what was recorded by running a command is marked via CLI.
  • When a done stage changes later (its page changed; for code generation only the plan is compared, and ticks do not count. A change to the code itself shows on the Build and Test line: the code changed after the last verify), its line gets (edited since) at the end. The AI should run lean stage done again, and say in the note what changed.
  • While some unit's code generation is not done, Build and Test shows only as in progress even when verify passes ([-] ... verify PASS on partial code).
  • When a code plan is half done, Next in lean status says "continue the code-generation plan of unit : step N of M".
  • Editing the content between the markers does the AI no good: the next time a stage command, lean request, lean verify or lean release runs, or an approval is recorded, this part is regenerated from the ledger. lean status also updates it on the way, for example after a git pull.

4. Traceability

  • Numbering: acceptance criteria in the requirements are AC-n, user stories are US-n, and business rules in the functional design are BR-n.
  • Each unit's code plan has a table: which test proves each AC and BR.
  • build-and-test-summary.md records the commands that ran, their exit codes, durations and output hashes, the code fingerprint, and the commit and working-tree state at verify time. Verify often runs before the commit; then its working tree: line gives the number of uncommitted product changes: what identifies the code is the fingerprint, not the commit id.
  • No extra detection tools are installed.

What Lean removes

AI-DLC originally Lean
Waits for a person to confirm after each stage (12 places in v1's core-workflow.md, 5 of them once per unit) People approve only at the 3 approval points (plus each unit's PLAN in regulated mode, plus IDEATION with Ideation); besides that, one batch of questions at the start, and a stop to ask when something fails
One question file per stage, answered with [Answer]: in the file All questions asked once at the start, each with a recommended answer; the Q&A is copied into requirements.md; after that, only questions that block the work are asked
Several files per stage (v1's reverse engineering has 8 plus a timestamp file, application design has 5) One page per stage
14 roles (the product, architecture, development, testing and other agents in awslabs/aidlc-workflows v2.11.3, the public AI-DLC release) No roles
A review and summary confirmation for each stage (v2.11.3) One review before release, by a new conversation or a subagent that did not write this code
Several files per stage in Ideation and Operations, each stage waiting for human approval; Deployment Execution done by the AI (main) Both phases optional, one page per stage; Ideation approved once, IDEATION, at handoff; Operations not approved; the AI does not deploy

Install

./install.sh <your-project-dir>                       # standard mode
./install.sh <project> --regulated                    # regulated
./install.sh <project> --multi-team --team payments   # multi-team (each clone sets its own team)
./install.sh <project> --with-pstack                  # also install the pstack quality pack (can be combined with the options above)

<project-dir> must come first. A wrong option (for example --regulate) exits with an error at once and changes nothing; --team must be followed by a team name; --help shows the usage.

A colleague already installed Lean (.kiro/ and aidlc-docs/ are in git): do not run install.sh in your clone. Get the kit with git clone or git pull, and in multi-team mode set your team with python3 .kiro/aidlc-lean/aidlc_lean.py init --team <name>. If you run install.sh in a clone that does not have those files yet, it creates them untracked, and the next git pull stops on them.

After install:

  1. Edit aidlc-docs/lean.json:
    • checks: commands that must all pass, for example ["pytest -q", "ruff check ."];
    • protected_paths: acceptance tests the AI must not change, for example ["tests/acceptance/**"].
  2. Commit .kiro/, aidlc-docs/ and .gitignore to git. .aidlc-lean/ is local state and has already been added to .gitignore. .gitignore counts as a product file: if it is not committed, lean release refuses because there are uncommitted changes.
  3. Run kiro-cli in the project folder, and choose to trust the workspace when asked. V3 is now Kiro CLI's default engine; older CLI versions needed kiro-cli --v3.
  4. The first time Kiro wants to run python3 .kiro/aidlc-lean/aidlc_lean.py, choose to always allow it, for that exact command only: never trust the whole shell tool. This permission also lets lean verify run every checks entry without asking you.

Dependencies: python3 (3.8 or later) and git, on macOS or Linux. No bun or node needed, and no network access.

lean.json is edited by people. The hooks block the usual ways the AI could change it (the write tool, and a shell line that names the file), but not a shell command that builds the path at runtime. It also has: plan (whether each unit's code plan needs approval: default auto, approval only in regulated mode; always means approval in every mode), approvers (the approver allow-list, per approval kind: IDEATION, REQUIREMENTS, DESIGN, INCEPTION, PLAN, RELEASE, CR), deny_commands (forbidden commands, as regular expressions; setting it replaces the default list, so copy the default entries from DEFAULT_CONFIG in aidlc_lean.py along with yours), fingerprint_exclude (paths not counted in the code fingerprint, for example ["dist/**"]; added on top of the default aidlc-docs/** and .kiro/**, which are never counted, except for contracts).

Reinstall and upgrade:

  • Re-running install.sh updates the kit files and keeps aidlc-docs/ (including lean.json) as it is. The script, the hooks, the always-on instructions and the 8 skills belong to the kit and are replaced in full each time; any changes to them are overwritten.
  • Templates can be changed: the templates in .kiro/aidlc-lean/templates/ are edited by people (the hooks block the usual ways the AI could change .kiro/aidlc-lean/), and teams can add their own. install.sh records the sha256 of each template it installs in .kiro/aidlc-lean/kit-templates.sha256 (called the manifest below), which is committed together with .kiro/. On reinstall:
    • templates nobody changed are replaced with the new version;
    • templates a person changed are kept, the kit's new version is written next to them as <name>.kit-new, and "Kept …" is printed. A person compares and merges them, then deletes the .kit-new. Each kit version is offered only once, and the manifest records the versions already offered: after you delete it, reinstalling the same kit does not offer it again; only when the kit ships a new version of this template is it offered again. Until the .kit-new is deleted, each reinstall rewrites it;
    • templates the team added are kept too, printing "Kept …: the kit does not ship it";
    • names that differ only in case: on a case-insensitive file system (for example macOS), the team's own CR.md and the kit's cr.md are the same file. CR.md is kept and not overwritten; the kit's version goes into cr.md.kit-new, again offered only once per kit version (the same for other names that differ only in case);
    • old templates the kit no longer ships are deleted only if unchanged (printing "Removed old kit templates …").
  • install.sh first only reads, without changing anything: it reads the templates and the manifest, decides what to do, then checks that every file it will write can be written (the kit's script and templates, the hooks, the always-on instructions, the skills, the pstack pack, aidlc-docs/audit/ and .aidlc-lean/; .gitignore when it still lacks the .aidlc-lean/ line; the contracts folder in multi-team mode). For files and folders that do not exist yet, it checks that the nearest existing folder is writable; aidlc-docs/lean.json must also be valid JSON. If any check fails, the install stops and prints "…; nothing was changed.", and truly nothing was changed: not even git init or creating folders has happened yet.
  • Files are changed only after these checks. If something still goes wrong later (for example the disk is full, or lean init fails), it prints "install.sh: stopped part way …": some kit files may already be the new ones. Fix the problem and run it again; re-running is safe.
  • If the manifest is not UTF-8, or has lines it does not recognize, install.sh prints a note:, still reads the records in it, and then rewrites the manifest.
  • When lean.json already exists, adding --regulated or --multi-team does not change the mode; the installer prints a WARNING (the same when you run lean init --regulated directly). To change the mode, a person edits "regulated" / "multi_team" in lean.json and commits; after switching to multi-team, re-run once with --team <name> to create aidlc-docs/contracts/OWNERS.
  • Upgrading from v0.2: just re-run install.sh; lean.json needs no changes. v0.2 has no kit-templates.sha256; install.sh recognizes the v0.2.0 templates as shipped, and keeps templates that differ from them as changed by a person, writing the new version into .kit-new. Intents started under v0.2 carry on as usual: their stage progress gets an extra first line - [S] Ideation — not used (no Ideation record: the intent was started before AI-DLC Lean 0.3), and further down extra lines for the CI pipeline and Operations; skip them if you do not need them. A v0.2 unit named ci-pipeline still works and need not be renamed: its pages are in a subfolder under construction/ci-pipeline/ and its plan is in construction/plans/, so they do not clash with the CI Pipeline stage's construction/ci-pipeline/ci-config.md; in regulated mode its PLAN gate is also the same as in v0.2.
  • Upgrading from v0.1 (everything of v0.1 is under aidlc/):
    1. install.sh stops when it sees aidlc/lean.json, and changes nothing.
    2. A person moves the config: mkdir -p aidlc-docs && git mv aidlc/lean.json aidlc-docs/lean.json. The v0.1 config says "contracts_dir": "aidlc/contracts"; change it to aidlc-docs/contracts (in multi-team mode, move aidlc/contracts/ there too); if you changed fingerprint_exclude, change it to the new paths too. Commit, then run install.sh.
    3. install.sh recognizes a v0.1 install by the template names only v0.1 has: there is no manifest; templates/ has at least one v0.1 name, with the same case (SPEC.md, PLAN.md, STATE.md, REVIEW.md, UNITS.md, DECISIONS.md, RELEASE.md, AUDIT-PACK.md, CR.md); and apart from lean.json (which v0.1 also has), it has no names from later versions. Once it recognizes one, it deletes all these v0.1 templates and replaces the lean.json template with the new version. In later installs, files with these names count as the team's own and are kept. The new templates are called cr.md and decisions.md, which differ from v0.1's CR.md and DECISIONS.md only in case. On a case-insensitive file system such as macOS, git keeps recording the old names; colleagues on Linux then get the old names, and lean doctor reports missing templates. So, of the old kit files install.sh deletes this time, those that git still tracks but that are not on disk under that name (with the same case) are removed from the index (git rm --cached; the files on disk are not touched), printing "Dropped from the git index …". After that, git add -A records the new names. Files the team added are neither deleted nor removed from the index.
    4. Run lean doctor and lean verify once. v0.1's intents, approvals and verify records stay in aidlc/; neither v0.2 nor v0.3 reads them; restart unfinished work with lean new.
    5. Once lean.json has moved, the old aidlc/ folder is no longer protected (the AI can change it), and it counts toward the code fingerprint (if it changes, you must verify again before you can commit). Move what you want to keep into aidlc-docs/, check it, then delete the old folder: git rm -r aidlc.

Installing in a subfolder of a large repo (monorepo): the project is the folder that holds .kiro/. aidlc-docs/, the audit ledger and the .gitignore line all live in this folder; kiro-cli must also be started in this folder (the v3 engine reads only .kiro/hooks in the workspace). checks run in this folder, and protected_paths and contracts_dir are both written relative to it. contracts_dir is taken as written and only tidied literally (./, extra slashes); it may contain .., to point to a shared contracts folder next to the project, for example ../../shared-contracts. If the folder is a symlink, both the link name and the folder it points to count as the contracts folder; on macOS, a name in a different case also counts as the same. Apart from v0.1's aidlc/contracts, lean doctor reports an error only when the value is unclear: empty, . (the project folder itself), or an absolute path that does not exist (it is then read as a path inside the project).

How one feature goes through Lean

lean is short for python3 .kiro/aidlc-lean/aidlc_lean.py. Both people and the AI can use lean status to see the progress and the next step.

  1. You say what you want built. The AI reads the code first, and opens an intent with lean new <name> (the folder is aidlc-docs/<yymmdd>-<name>/; the date is in UTC, the same as Created in the pages). For existing code, reverse engineering comes first; new projects skip it. When a product manager needs to work out the idea first, use lean new <name> --ideation: Ideation comes first, and this step comes after IDEATION is approved (see 1a).
  2. The AI asks all its questions at once, each with a recommended answer. You can reply "all as recommended", or change just a few. The Q&A is copied into requirements.md; what the AI guessed is written as "assumptions" (A-1 …), and what you told the AI to decide is also written as an assumption, not as your answer. Before each later question, the AI first looks in decisions.md and requirements.md: what is already settled it cites by ID (for example "per D-74") instead of asking again. Facts confirmed later (an interface, a version, an endpoint) also go into decisions.md, each saying which line it answers ("answers D-48"); there is no separate question file.
  3. The AI writes requirements.md: size (change the template placeholder Size: <small|large> to small or large; a new public module or interface, a new data model, a schema or interface change, or work across several modules all count as large), goals, out of scope, acceptance criteria (AC-1 …), NFR targets, assumptions. When needed it also writes user stories, application design and units generation. After each stage it runs lean stage done, and lean stage skip for stages it does not need. None of this stops to ask you.
  4. The AI runs lean request INCEPTION and gives you the approval line, for example approve INCEPTION 8cf2cbce. You read the requirements and design pages and, if you agree, type this line yourself. To settle the requirements first, approve REQUIREMENTS first, and DESIGN when the design is written. Every time before it stops to wait for you (questions, approvals), the AI must update the Session notes first; while the Session notes are still the template as is, lean request reminds it.
  5. One unit at a time (just app without a unit split):
    • write the functional design, NFR design and infrastructure design as needed; when one is not needed, skip it with a reason;
    • lean stage start code-generation creates the code plan: step 1 is the thinnest path that runs end to end (with one passing test), and each step says which AC/BR it covers and what counts as done;
    • regulated mode: lean request PLAN --unit <unit>; code for this unit can be written only after you approve it;
    • write code and tests step by step following the plan, and tick each step in the plan when it is done ([x]; an approved plan is ticked the same way). lean stage done code-generation can run only when all steps are ticked; it refuses while any step is unticked.
  6. The AI runs lean verify: it runs the commands in checks and writes build-and-test-summary.md. When checks are configured, git commit is blocked without a verify that passed on the current code. Run verify as its own command; do not chain it with git commit. Commits that carry only files under aidlc-docs/ or .kiro/ do not need verify (except contract files, which count toward the code fingerprint), even when the working tree still has unstaged product changes: for example, halfway through the code, first commit the Session notes with git add aidlc-docs/ && git commit -m .... The hook looks at what this commit carries: what is already staged, plus what git add <path> on the same line would add. When it cannot tell (git commit -a, git add -A, a command line with cd or $(...)), it counts the whole working tree.
  7. The review must be done by a context that did not write this code: open a new conversation (/chat new), or hand it to a subagent that did not write the code (pstack's multi-model review is a subagent too). An old conversation continued with --resume is not a new context. The result goes into construction/build-and-test/review.md. When review.md is newer than the latest verify and the latest code change, Next in lean status points to lean release; so after fixing the review findings and verifying again, add to review.md what was fixed.
  8. The AI runs lean release to write operations/release.md (in its approvals table, older approvals replaced by later ones are marked), fills in "Open items" (unresolved problems, known gaps, follow-up work), then runs lean request RELEASE. While there are uncommitted product code changes, lean release refuses; commit them first. You type approve RELEASE <hash>. If the approvals table in release.md lacks an approval it should list (compared cell by cell for each row of the table, ignoring the amount of whitespace; text in comments or outside the table does not count), this release.md is void. It should list the approvals of this intent and the approvals of all CRs, for example when the requirements changed and were approved again, or another team approved a CR (no matter which intent was active when it was approved, in which clone it was approved, or whether that machine's clock was right). Then run lean release again and request again; the old approval line no longer counts. This rule compares the content of the approvals table, not times. Once approved, the intent is closed: only its Operations pages and ci-pipeline can still be changed and still accept stage commands; later design changes, follow-up work and bug fixes are opened with lean new. lean status and the state injected at session start both say that it is released (RELEASED).
  9. Optional: the CI pipeline and Operations pages (see 1a), recorded before lean release, or after RELEASE is approved; the AI does not deploy. If you do not need them: lean stage skip ci-pipeline --reason "...", lean stage skip operations --reason "...".

Small changes (a typo fix, one config value, a small fix in one file) need no intent; make them directly, also when the active intent is already released. Except in regulated mode.

When a clone has never picked an intent and aidlc-docs/ holds only one, that one is used automatically (for example, an intent on the main branch that is not released yet), and writing code waits for its approvals. To work in this clone without an intent, run lean use --none: writing code waits for no stage approval, and when checks are configured, a commit still needs a verify that passed. lean use <intent> or lean new ends it. Not available in regulated mode.

Commands

lean init [--regulated] [--multi-team] [--team NAME]  create aidlc-docs/ in the project (install.sh calls it)
lean new <slug> [--title T] [--ideation]             open an intent and make it the active intent (--ideation: start with Ideation)
lean use <intent>                                    switch the active intent (logged)
lean use --none                                      no active intent in this clone, not even when there is only one (logged; not available in regulated mode)
lean status                                          current progress and the next step (also updates the generated part of aidlc-state.md)
lean stage start <id> [--unit U]                     create this stage's document from its template; mark it in progress
lean stage done <id> [--unit U] --note "<text>"      record what this stage did
lean stage skip <id> [--unit U] --reason "<reason>"  record why it is skipped
lean stage skip ideation|operations --reason "<reason>"
                                                     skip, as a whole, the Ideation or Operations stages with no record yet (Operations: not ci-pipeline)
lean request IDEATION|REQUIREMENTS|DESIGN|INCEPTION|PLAN [--unit U]|RELEASE|CR-<team>-<n>
                                                     print the approval line for the human
lean verify                                          run checks, write build-and-test-summary.md (regulated mode: also an evidence file)
lean cr new <slug> --owner TEAM --paths a,b          open a contract change request (CR)
lean cr close <id> --reason "<reason>"               close a CR (the requesting or the owning team can close it); after that it lets no change through
lean release                                         write operations/release.md once the approvals and verify are all in place
lean audit verify | lean audit pack [intent]         check the audit ledger's hash chain / write aidlc-docs/<intent>/audit.md
lean doctor                                          check the install
  • stage done refuses while the document is not written yet, or is still the template as is.
  • After release, only the Operations stages and ci-pipeline still accept stage commands.
  • request RELEASE gives the approval line only when lean release would pass now, release.md was written by lean release for the current code, and since then no other approval has been recorded (RELEASE's own do not count), and no stage record either (those of Build and Test and Release themselves do not count). An approve RELEASE typed by a person is checked against the same conditions: for example, if IDEATION or the requirements are stale or rejected at that point, or were approved again, this approval does not count, and the ledger records an APPROVAL_REFUSED. Then the line in stage progress gives no approval line: when something is stale or rejected it is [-] Release — RELEASE requested; the approval waits: not ready to release: ...; after a new approval it is [-] Release — release.md (written <date>) does not list <kind> approved: run `release` again, and you run lean release again (the new release.md lists the new approval), then request again. When a new stage record was made it is [-] Release — release.md (written <date>) is older than <stage> <skipped|done|started>: run `release` again, and again you run lean release again. A rejection of RELEASE itself does not count here: if the code did not change, fix the same release.md as the person said, and you can request again.

What the hooks block

Hooks are scripts Kiro runs automatically at session start, when you send a message, and before the AI calls a tool. They check for the cases below; when they find one, they block it and tell the AI why ([AI-DLC Lean] blocked (<gate>): ...):

Case Result Gate
Ideation is used and code is written while IDEATION is not yet approved (or was rejected); in regulated mode, also when approved Ideation pages were changed since Blocked ideation
There is an active intent, and code is written before the requirements are approved Blocked requirements
Code is written while the design is not approved and not skipped under Size: small Blocked design
Regulated mode: code for a unit is written while the unit's code plan is not approved Blocked plan
Regulated mode: an approved page was changed later (in an approved plan, only ticking steps is not a change; changing a step's text is) Blocked; approve again requirements / design / plan / ideation
Regulated mode: code is changed with no active intent Blocked intent
Regulated mode: code is changed after the active intent was released Blocked; open a new intent released
Changing acceptance tests (protected_paths) Blocked; after you type allow test change, let through until your next message (for all sessions and subagents in the same clone) protected
Checks are configured, and a commit is made without a verify that passed on the current code Blocked verify
Regulated mode: a commit with no checks configured Blocked verify
Commands on the deny list: by default only a few (git push --force, rm -rf /, terraform apply, kubectl apply, kubectl delete, dropping tables, and so on); teams add to deny_commands in lean.json Blocked; if needed, a person runs it themselves. The list is short and cannot cover every deploy: "the AI does not deploy" relies on the rules and the team's permissions (see 1a) danger
The AI changes the audit ledger, local state, aidlc-docs/lean.json, contract OWNERS, the kit in .kiro, or files the tool writes (build-and-test-summary.md, evidence files, audit.md). Reads are not blocked: the file-read tool, and shell commands that only read (see the first note below the table) Blocked records
Multi-team: changing another team's contract without a CR that your team requested, the other team approved, and that is not closed yet Blocked contract
  • Read-only shell commands that read the audit ledger, local state and aidlc-docs/lean.json are not blocked (a false block fixed in v0.3.1: before, even cat aidlc-docs/lean.json was blocked, so the AI could not see the approver list). The condition is that every command segment on the line only reads: cat, head, tail, wc, ls, grep, jq, stat, diff, echo, cd and the like, with no redirection other than input from a file, output to /dev/null (such as 2>/dev/null) and 2>&1; or a git command that only looks and changes nothing, such as git status/log/show/diff; or lean itself (with no record path in its arguments). Reading with other programs (sed, awk, find, python3), piping into other programs (| python3 -c, | xargs, | tee), writing to these files, or a line with $(...) or a here-document is still blocked: use the file-read tool or lean status instead.
  • A find that names these paths only to leave them out passes too: -not -path <path> or ! -path <path> with no -o or -prune after it, or -path <path> -prune -o. The same holds with -ipath, -name, -iname, -wholename, -iwholename, -regex or -iregex in place of -path. The hook checks the rest of the line as if those paths were not there. Still blocked: a find that starts in these folders or selects them (find .aidlc-lean, find . -path './.aidlc-lean/*'); a find with ( ) groups or ,, or with braces that hold , or .. (the shell turns {a,b} into two words); a find with -exec, -execdir, -ok, -okdir or -delete; and every find on a line that names xargs. Other programs that run commands on what a find lists are not recognized: find . -not -path './.aidlc-lean/*' | parallel rm passes.
  • In standard mode, when an approved page changes again, writing code is not blocked, and lean status marks it as stale; but lean release requires all approvals to match the current files.
  • In standard mode, once the active intent is released it is treated as if there were no active intent: writing code is not blocked, and small changes go on as usual; new features and follow-up changes open a new intent with lean new. A released intent accepts stage commands only for the Operations stages and ci-pipeline; all other stage commands are refused.
  • Writing pages in aidlc-docs/, *.md and docs/** is not limited by approvals. Contract files are the exception (files under contracts_dir, default aidlc-docs/contracts/, not including OWNERS and the CRs in changes/): they count as code and pass the same gates above as code (with Ideation, IDEATION first, then the requirements and design; in regulated mode, an intent and the PLAN of the unit they belong to). In multi-team mode, changing another team's contract also needs an approved CR from that team first; changing your own team's contract just does not need a CR.
  • The hooks cannot recognize every way of writing a file: using the shell or other tools, the AI can still get around some of the checks. The final backstops are verify before commit, the approval and verify checks before release, and the protected branches and MR approvals on the Git server.
  • Blocked calls are usually recorded in the audit ledger (except when aidlc-docs/lean.json is broken: still blocked, but not recorded). Subagents writing code with the file tools are blocked too (tested for real in v0.1).

Three scenarios

Regulated (--regulated):

  • An intent must exist before code is changed; after the active intent is released, changing code is blocked too, and you need lean new first;
  • Approval lines must include the hash;
  • If an approved page changes again, the approval is void, writing code is blocked, and it must be approved again;
  • Each unit's code plan must be approved (PLAN). An approved plan can still have its steps ticked without voiding the approval; changing a step's text needs a new approval;
  • With the Ideation stages, IDEATION must be approved too, and must match the current Ideation pages, before the requirements can be approved and code written; the Operations phase is optional in regulated mode too;
  • Without checks configured, you cannot commit, and cannot run lean release;
  • When a hook script itself fails, the tool calls it checks are blocked, never let through (the read tools are not checked);
  • Verify also writes an evidence file (construction/build-and-test/evidence/verify-<time>.md), and the ledger records its sha256;
  • Common password and key patterns in evidence are masked: key-value pairs whose names contain password (or passwd, pwd), secret, token, api_key, access_key, private_key or credential (for example DB_PASSWORD=…, "password": "…"), Authorization / Bearer headers, user:password@ in URLs, GitHub / AWS (AKIA, ASIA) / Slack tokens, and private key blocks. Passwords without an obvious name or prefix cannot be masked, so do not let checks print passwords;
  • lean audit pack writes aidlc-docs/<intent>/audit.md: ledger integrity, each stage's records, approvals and rejections (including refused approval lines), verify (with the first 12 characters of the evidence file hash), blocked records, allowed acceptance-test changes, CRs, intent switches, sessions. It includes only this intent's own events and CRs, and sessions and subagents only from its creation to its release. Approvals a person typed in the conversation are marked human (prompt), entries recorded through the command line (stage commands, verify, release and so on, run by the AI) are marked via CLI, and entries the hooks record themselves (session start, subagent start and so on) are marked hook (...), so you can see at a glance who did what;
  • In regulated mode every change goes through an intent, people's own changes too (with the MR approvals on the Git server as the final check). The AI does not suggest that you "just change it yourself"; it only proposes opening a new intent.

Regulated mode is a stricter workflow; it does not by itself make a project compliant with any regulation.

An approver allow-list can be configured (by git email), for example "approvers": {"RELEASE": ["lead@example.com"], "IDEATION": ["pm@example.com"]}. INCEPTION must pass its own list and the REQUIREMENTS list, and the DESIGN list too when it covers the design page; a SPEC list written for v0.1 still governs the requirements and design approvals.

Multi-team (--multi-team --team X):

  • In each clone (each person's local copy of the repo), a person sets the team: lean init --team <name>, or the environment variable AIDLC_LEAN_TEAM. The name is stored as written (a space is stored as _); it may contain - and ., and may also be in Chinese; when teams are compared, -, . and _ count as the same (web-team and web_team are the same team), and CR ids write it with _ (CR-web_team-1);
  • inception/application-design/unit-of-work.md lists each unit: name, owning team, code paths, what it depends on, which contracts it uses. Each team works on its own units in its own clone. Next in lean status mentions only this team's units, and when it is another team's turn, it says which unit it is waiting for;
  • aidlc-docs/contracts/OWNERS says which team owns each contract, and is maintained by people;
  • Each intent has an owning team (Owner team, the team that started it), written at the top of aidlc-state.md. It does the review and the release; other teams just finish their own units and push. For an intent a product manager opened with --ideation, a person changes that line to the team responsible for the release;
  • Session notes have one section per team: ### Next (team <name>), with that team's status, next steps and blockers; each team edits its own section, so they do not overwrite each other. When a new conversation starts, the hook injects this team's section first;
  • To change another team's contract, first run lean cr new, fill it in and push; the other team runs lean request CR-... in their own clone and approves it; after you pull, the hook lets you change that contract. It lets through only the team that requested it, only the files listed in the CR, and only until the CR is closed: when the other team has finished the change, they close it with lean cr close <id> --reason "..." (either team can close it). Changing your own team's contract needs no CR;
  • Contract files count as code: like code, they wait for approvals before they can be written (in regulated mode, also the PLAN of the unit they belong to), so put the contract paths in the Paths column of the owning unit in unit-of-work.md; contract drafts before approval go in application-design.md. After a contract changes, verify again before you commit and release;
  • When two clones merge, the tool-generated content (the generated part of aidlc-state.md, build-and-test-summary.md) may conflict. Running lean verify once rewrites both from the ledger; where a conflict extends outside the generated part (into the Session notes), the outside part is left as one complete conflict (<<<<<<< to >>>>>>>): merge it by hand, delete the markers and commit. When the conflict markers do not match up (for example only ======= and >>>>>>> are left), the tool does not change the file and only tells you to fix it by hand first. The audit ledger is one file per clone, so it does not conflict;
  • Code ownership and merge approvals are left to GitLab CODEOWNERS and MR approvals; the kit handles only contracts.

Multi-day:

  • aidlc-state.md goes into git and is the handoff sheet: the top half is the tool-generated stage progress and stage log, the bottom half is the Session notes the AI writes (current status, next steps, where it is stuck, reminders for the next session);
  • When a new session starts, the hook injects the first few items of Next in the Session notes and the stage progress into the AI (Next first; when it is too long, the stage progress is cut first). At most 40 lines and 4,000 characters; anything more is truncated, with a hint to use lean status to see it all;
  • When the same conversation speaks again after 4 hours or more (the default), the state is injected again, with a reminder to pull first. This is counted per conversation; other conversations being busy does not affect it;
  • Going back to an old conversation: kiro-cli chat --resume opens the latest conversation in this folder. To go back to an earlier one, use kiro-cli chat --resume-id <session-id> (kiro-cli chat --list-sessions lists the session ids). A resumed old conversation remembers the code it wrote, is not a new context, and cannot be used for the review before release;
  • If the AI has changed code 25 times (the default) without updating aidlc-state.md, the hook reminds it to update it; while the Session notes are still the template as is, lean request also reminds it to update them first when it prints the approval line;
  • When another person or team takes over (including a product manager handing over to the development team after IDEATION is approved): they run lean use <intent> (either the full folder name or the name after the date works; it is logged) and carry on. Approvals, stage records and verify results all travel with the audit ledger in git. Before committing, they must re-run verify once in their own clone, because a verify counts only in the clone that ran it.

Optional: pstack quality pack (--with-pstack)

./install.sh <project> --with-pstack installs an extra set of "code quality" cards. They are adapted from Lauren Tan's pstack 0.15.32 (MIT license; the attribution is kept at the end of each card and in .kiro/aidlc-lean/LICENSE-pstack; if you later reinstall without --with-pstack, this license file is kept too). Lean handles the process and the gates; these cards handle whether the code is written well and whether the verification is real.

  • 8 principle and tool cards:
    • run it on the real thing before you call it done;
    • test behavior, not implementation;
    • put validation and permissions at the system boundary;
    • fix root causes;
    • split the work into small steps that can be verified on their own;
    • think the data model through first;
    • before a change, find out what it affects (blast-radius);
    • when the same kind of mistake shows up twice, make a tool block it (correct).
  • pstack-interrogate (multi-model adversarial review): sends out two reviewers at once, lean-reviewer-opus (Claude Opus 5.5) and lean-reviewer-second (the session's model); the main agent merges their findings into construction/build-and-test/review.md, in four groups, "Act on / Consider / Noted / Dismissed", plus a section "Out-of-design changes": the main agent checks against the design itself and lists the interface, field or behavior changes that are not in the design (and whether there is a matching decision record), or writes none.
    • The brief is written only once: the main agent writes the intent, the full diff, the acceptance criteria table, the review rubric and the code quality points into construction/build-and-test/review-brief.md, then in one message sends each reviewer a short prompt that points to this file. This way both reviewers should start at the same time (not yet re-verified in Kiro), and the brief is on record (committed with review.md).
    • Both reviewers are read-only: their cards say tools: ["read"]; they can only read and search files, and cannot run commands or write files. The main agent writes the diff and the test output into the brief; whatever a reviewer wants confirmed, it writes as a command, and the main agent runs it.
  • pstack-swarm (parallel subagents): up to 5, for researching existing code, multi-model checks and adversarial tests. The shared brief also goes into a file (construction/swarm/brief.md), and each subagent gets only a short prompt: the file path plus its own part. Writing code in parallel goes only to lean-worker, and only after each worker has been given files that do not overlap, through unit-of-work.md or the code plan.
  • The always-on part adds only one mapping page (144 words), which tells the AI which card to use at which stage. Everything else loads only when used: 10 cards with 4,561 words, the interrogate reference files with 2,279 words, 3 subagent cards with 470 words.

Tested on kiro-cli 3.1.0:

  • Subagents use the model set by model: in .kiro/agents/*.md; the model in Kiro's own subtask records matches the cards;
  • Several subagents sent out in one message run in parallel, but Kiro starts a subagent only after the whole content of its call has been written out. With a long brief, the second reviewer starts noticeably later, so now the brief goes into a file and the prompt is a single sentence;
  • Subagents' tool calls also go through the workspace hooks.

The two reviewers are lean-reviewer-opus on Claude Opus 5.5 and lean-reviewer-second on the session's model (its card has no model: line), both read-only; the pack names no other model. They were run for real once on a small existing-code project, when the second card still named a fixed model: the two reviewers only read and searched files, wrote no files and ran no commands; the main agent sorted the two reviews into "Act on" and the other groups, fixed the findings, verified again and committed. Writing the brief into a file was changed after that run, and has not been re-run in Kiro yet; neither has lean-reviewer-second without a model: line.

lean-reviewer-second runs on the same model as the session that wrote the code, but in a fresh context that did not write it. For a different model, a person adds a model: line to .kiro/agents/lean-reviewer-second.md, naming another model their Kiro offers. If the session itself runs on Claude Opus 5.5, both reviewers are the same model, and the different view comes only from the fresh contexts.

The review models are set in .kiro/agents/lean-reviewer-*.md; if your Kiro does not have Claude Opus 5.5, or you want another model for the second reviewer, a person changes or adds the model: line (the hooks block the usual ways the AI could change these files). On reinstall, cards where a person changed model: are kept, printing "Kept …" (a model: line added to lean-reviewer-second.md counts as a change). Two cards from older packs are deleted: lean-reviewer-gpt.md, and lean-reviewer-k3.md while its model: is still the one that pack shipped; a lean-reviewer-k3.md whose model: a person changed is kept, printing "Kept …". The team's other .kiro/agents/lean-*.md files are not touched.

After pstack is upgraded, regenerate these cards:

python3 tools/vendor_pstack.py                 # use the newest version under ~/.claude/plugins/cache/cursor-plugins/pstack/
python3 tools/vendor_pstack.py <pstack-dir>    # or point to a pstack folder

The version number at the end of each card is read from that folder's plugin.json. If any check fails, kit-pstack/ stays as it is: the places where the upstream text changed and the adaptation no longer matches are all listed at once; once these all match, the generated cards are checked again as a whole, and those problems are also listed at once.

What has been tested

  • Unit tests: python3 -W error::ResourceWarning -m unittest discover -s tests, 311 in total, run on Python 3.9 and 3.12.

    File Count
    test_aidlc_lean.py 30
    test_fixes_script.py 32
    test_fixes_install.py 34
    test_v02_stages.py 34
    test_v02_integration.py 12
    test_v02_live_fixes.py 22
    test_v03_phases.py (v0.3's Ideation, CI pipeline and Operations phases) 25
    test_v03_qa_fixes.py (logic problems found in the v0.3 QA, including contracts counting as code) 46
    test_v03_install_fixes.py (on reinstall: keeping the templates people changed and teams added, offering .kit-new only once, and when the manifest or a template cannot be read) 18
    test_v031_fixes.py (the v0.3.1 fixes, including read-only shell commands and a find that only leaves the records out no longer being falsely blocked, and looking in decisions.md before asking) 50
    test_v032_use_none.py (v0.3.2: lean use --none; a new clone is no longer gated by the only unreleased intent on the main branch) 8

    Coverage: every gate (including v0.3's ideation), the approval rules (including the IDEATION hash, staleness, rejection and allow-list), stage commands and stage records, skipping Ideation and Operations as a whole, Operations stages after release, per-unit PLAN, tamper detection, multi-team units and CRs, contracts waiting for approvals like code, the release flow, the pstack quality pack, install and upgrade from v0.1, keeping templates the team changed or added on reinstall, parallel hooks, subfolder installs, masking. The instruction text itself is also checked: every command and every gate name mentioned in the always-on instructions, the skills and the templates really exists, and the word counts stay within limits (the always-on instructions at most 1,000 words, each of the 8 core skills at most 600 words; no limit for the pstack pack cards). Some tests are skipped where they cannot run: the 8 vendor_pstack tests when the pstack 0.15.32 source is not on the machine, 1 upgrade test when the git history lacks the v0.2.0 commit, and 2 letter-case tests on a case-sensitive file system (such as Linux's). Python 3.8 has not been run for real; the code has only been checked against 3.8 syntax.

  • v0.2 simulated runs: no kiro-cli and no real AI. A script fed every file write and command of the "AI" and every message of the "human" to the hooks, in the Kiro v3 hook format, through 4 scenarios: standard mode, standard mode with pstack, regulated (two units, PLAN approved per unit, one rejection), multi-team (two clones, one CR, one merge conflict). The aidlc-state.md example above came from these runs.

  • Live tests (kiro-cli 3.1.0, v3 engine, main model Kimi K3, a small project in a sandbox):

    • v0.1: all 3 hooks fire, and the AI sees the injected state; the AI writes the requirements document following the process and offers the approval line on its own; when you say "just do it", it does not write code, and when told to write code directly, the hook blocks it on the spot; after the approval line is typed, it writes code, verify passes and the commit succeeds; asked to change the acceptance tests, it refused; subagent file writes are blocked too; release approval, the audit ledger hash-chain check and the audit pack all work.
    • v0.2: all 5 scenarios reached RELEASED, and audit verify was OK in all of them: standard mode (a small request; the human sent only 3 messages and approved twice); regulated (an approval without a hash was refused, PLAN approved per unit, approved again after an acceptance criterion was added halfway through, verify wrote evidence files); multi-team (two clones doing push/pull through a bare repo, through the full CR flow); multi-day (a new conversation continued from step 2 of the plan, then 5 hours later the old conversation was resumed to finish the release); existing code + pstack (reverse engineering first, two read-only reviewers).
  • To be clear:

    • In the live tests the AI never tried a shortcut that would be blocked, so most gates have never really fired live. In the v0.2 live tests, the only gates that blocked anything were verify, protected, records (one false block) and contract. The requirements, design, plan, released, intent and danger gates are covered by unit tests.
    • The fixes made after the v0.2 live tests (including the v0.3.1 fixes; see the design notes §8, §10) have only unit tests, and have not been re-run in Kiro.
    • v0.3's Ideation phase (the IDEATION approval, the ideation gate), the CI pipeline and the Operations phase have only unit tests: no simulated run, and no live run in Kiro. The two new skills are written for product managers and operations; whether the AI can write good pages from them, and whether it makes up numbers, has not been verified.
    • Environment: user-level Kiro config (the agents, hooks, memory, steering and MCP in ~/.kiro) also enters the session. For a fair test, use a clean Kiro config, or pick an agent without user hooks, memory and MCP. For a clean config, point KIRO_HOME at a new or empty folder, as in KIRO_HOME=/tmp/kiro-clean kiro-cli. Kiro then reads its user-level config from that folder instead of ~/.kiro, and you stay logged in. Do not use a separate HOME for this. Kiro then reports "Not logged in", because on macOS it keeps the login in ~/Library/Application Support/kiro-cli.

Known limitations

  • Acceptance-test protection and verify's comparison are both only partial. The hooks cannot recognize every way of changing a file, and verify's comparison also has cases it cannot catch.
    • If you add or change acceptance tests yourself, verify fails (it compares against the acceptance tests as they were when the requirements were approved). Once you have confirmed they are fine, have the AI run lean request REQUIREMENTS and approve again; verify then takes the current files as the baseline.
  • The audit ledger's hash chain can detect a line in the middle being changed or deleted. It cannot detect the last few lines being deleted, a clone's whole ledger being deleted, or the whole ledger being rewritten; for that, rely on git history and protected branches. audit verify does not recompute evidence file hashes (the ledger records their sha256, which can be compared by hand).
  • Approver identity is self-reported by the local machine (git email, OS user, host name). Real identity relies on the Git server and company accounts.
  • Privacy: every audit ledger entry records the git email and name, the OS user name and the host name of the machine that wrote it, and each clone's ledger file (aidlc-docs/audit/<host>-<id>.jsonl) is named after the host. The ledger is committed to the repository, so everyone who can read the repository can see them.
  • Through a chat bridge (for example a bot that forwards Feishu or Slack messages to Kiro), text the bridge injects is treated as what the person said. That is why regulated mode requires a hash on approvals. The bridge must check for itself who approved, and append (via 飞书 张三 msg-123) to the approval line (channel Feishu, person Zhang San, message id msg-123); Lean records it as the "claimed channel".
  • Size is filled in by the AI. The requirements template has the placeholder Size: <small|large>; the AI changes it to small or large by the rules; while it is still the placeholder, it counts as not small, and application design cannot be skipped. Glance at this line when you approve the requirements.
  • Stage order and stage records are not enforced. The hooks check only the gates in "What the hooks block", not stage records or the review before release. A missed stage record is not blocked; it only shows as [ ] in lean status and release.md; Next in lean status reminds you in AI-DLC order.
  • The Operations phase is only records. Release does not wait for the Operations pages, and RELEASE does not cover their content; the deployment log, load-test results and SLO results are filled in by the AI from the facts people and pipelines give it, and the tool does not check whether a deploy really happened. "The AI does not deploy" is a rule written for the AI; the deny list is short and cannot stop every deploy command. The real control over deploys and rollbacks is in the team's CI/CD and permissions.
  • Code plans accept only one check-box form: the PLAN hash treats only [x] and [X] after a leading - or * as [ ]. Other forms (for example 1. [x]) count as changes when ticked, and the PLAN approval goes void.
  • RELEASE accepts only a release.md written by lean release for the current code. Once the code changes, verify again, run lean release again and approve again; if another approval or a stage record is recorded after lean release (before the RELEASE approval), also run lean release again and approve again. To approve RELEASE in another clone, the code there must be exactly the same (same commit, no local changes); with checks configured, that clone must also pass a verify first (verify counts only in the clone that ran it). The stage progress there still shows [A] (see section 3), and lean status there tells you to run verify first.
  • Contract files wait for approvals like code. With one team or many, the contracts under aidlc-docs/contracts/ (except OWNERS and the CRs in changes/) count as code: they can be written only after IDEATION (when Ideation is used), the requirements and the design are approved, and in regulated mode they also need an intent and the PLAN of the unit they belong to; in regulated mode, contracts not in any unit's Paths wait until all PLANs are approved. To draft a contract before approval, write it in application-design.md.
  • The stage log is in the order the records were made. In multi-team mode, the two teams' entries are interleaved; the stage progress list above it is in AI-DLC order.
  • Do not name a unit swarm: pstack's parallel subagents write their reports under construction/swarm/, which would mix with that unit's folder.
  • False blocks:
    • Kiro's code tool (reads such as symbol lookup) and writes to files outside the repo (for example in /tmp) may be blocked as code writes before the requirements and design are approved;
    • a shell line that names a record path (aidlc-docs/audit/, .aidlc-lean/ or aidlc-docs/lean.json) is blocked, except when every command on it only reads (cat, head, grep, jq, ls, read-only git and the like, or lean with no record path in its arguments), or when each command on it that names a record path is a plain git add or git commit (or a read-only git command) with no -f and no >, as in git add aidlc-docs/lean.json && git commit -m config. A path that a find names only to leave it out does not count (see "What the hooks block"), and neither does the text after --note, --reason or --title in lean stage and lean cr. So these lines are blocked even when they change nothing: reading the records with sed, awk or python3, piping what was read into another program (| python3 -c), and leaving the records out with another program (tree -I .aidlc-lean) or with a find that also uses -exec or xargs. Use the file-read tool or lean status instead;
    • when aidlc-docs/lean.json is broken (not valid JSON), every tool call except the read tools is blocked, and nothing can be recorded in the ledger.
  • Tested only on Kiro CLI's v3 engine (the live tests started it with kiro-cli --v3; V3 is now the default, so kiro-cli is enough). The v2 engine uses a different hook config (agent JSON), which is not supported here.
  • Windows is not supported yet: the gates there may silently fail. Use macOS or Linux, or the Linux version of Kiro in WSL.
  • Not tested live yet:
    • multiple machines (the multi-team test was two clones on one machine);
    • large legacy systems (the existing-code scenario was a small web app);
    • most gates firing live (see "To be clear" above);
    • the fixes made after the v0.2 live tests, including whether the two reviewers really start at the same time now that the brief is in a file;
    • v0.3's Ideation, CI pipeline and Operations phases;
    • the v0.3.1 fixes;
    • v0.3.2's lean use --none.
  • Large repos: computing the code fingerprint borrows git's index cache and rereads only changed files; files not in git are read in full the first time. v0.2 measured on a 50,000-file repo (Apple M3 Pro): with an active intent, session start about 0.6 s and the commit check about 0.3 s; after the fingerprint cache in .aidlc-lean/ was deleted, the first session start took about 0.8 s.

Layout

install.sh                                installs the kit into a project
kit/.kiro/steering/aidlc-lean.md          always-on rules (999 words)
kit/.kiro/skills/aidlc-lean-*/            8 skills loaded on demand: ideation, inception, construction, release, operations, resume, multi-team, regulated (4,784 words in total)
kit/.kiro/hooks/aidlc-lean-*.json         3 v3 hooks
kit/.kiro/aidlc-lean/aidlc_lean.py        the only script (4,507 lines)
kit/.kiro/aidlc-lean/templates/           28 templates (5,502 words in total): 24 stage documents (v0.2's 9, plus v0.3's 7 Ideation, 1 CI pipeline and 7 Operations), plus aidlc-state.md, decisions.md, cr.md, lean.json
tests/                                    unit tests (11 files, 311 tests)
docs/design-v0.2.md                       v0.2 design notes (§9 covers v0.3's Ideation, CI pipeline and Operations phases, §10 the v0.3.1 fixes)
kit-pstack/                               optional pstack quality pack (10 cards, 3 subagents, MIT license)
tools/vendor_pstack.py                    regenerates kit-pstack/ from the pstack source

Security

To report a security issue, see CONTRIBUTING. Do not report it in a public issue.

License

This repository is released under the MIT-0 license; see LICENSE. kit-pstack/ is adapted from pstack (MIT license); see THIRD-PARTY-LICENSES.

About

AI-DLC Lean: a lightweight AI-DLC workflow kit for Kiro CLI (v3). Same stages and aidlc-docs/ layout as AI-DLC, three human approvals (requirements, design, release), a hash-chained audit log and verify-before-commit, with optional Ideation and Operations phases. Sample code, not for production use.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages