Skip to content

AI-native workspace: full roadmap (Phases 1-4) - #3

Merged
lakpriya1s merged 9 commits into
mainfrom
devrig-ai-native-phase1
Aug 17, 2026
Merged

AI-native workspace: full roadmap (Phases 1-4)#3
lakpriya1s merged 9 commits into
mainfrom
devrig-ai-native-phase1

Conversation

@lakpriya1s

Copy link
Copy Markdown
Owner

What & why

Implements the full 52-item roadmap in tasks.md for evolving devrig from an
"AI-ready multi-repo workspace" into an "AI-native development workspace
where agents can discover context, plan work, execute safely, verify
results, preserve knowledge, and improve future work." Delivered as four
phases (foundation → reliability → learning → intelligence/measurement),
one commit per phase.

Phase 1 — Foundation

  • AGENTS.md: Commands table, Definition of Done pointer, concrete Semble
    retrieval policy, Context efficiency section.
  • POLICY.md (new): Definition of Done, ADR requirement, verification
    evidence / confidence / source-citation formats, and (added in Phase 2)
    forbidden/approval-required actions, protected paths, risk levels, data
    handling, agent roles.
  • Every knowledge/ doc now carries YAML frontmatter (status, authority,
    owners, authorship, …) instead of a plain blockquote — documented
    lifecycle states and authority ranking in knowledge/README.md.
  • knowledge/index.md, generated by scripts/build-knowledge-index.mjs.
  • /start-task gathers context (systems, ADRs, designs, likely files, risks,
    test plan) before any code changes; new /plan-task (written plan + human
    approval gate) and /verify-change (evidence per POLICY.md).

Phase 2 — Reliability

  • .ai/{systems,commands,ownership,policies,risk-levels}.yaml mirror
    AGENTS.md/POLICY.md for tools/CI, validated against
    .ai/schemas/*.schema.json with a small dependency-free YAML/JSON-Schema
    reader (scripts/lib/).
  • scripts/validate-knowledge.mjs (frontmatter completeness/enums,
    canonical-requires-human_reviewed, ADR id/filename consistency, broken
    links, generated-index freshness) and scripts/check-adr-requirement.mjs
    (protected-path change ⇒ ADR in the same diff), wired into
    .github/workflows/{validate,knowledge-check}.yml.
  • /raise-pr's PR template now includes Systems affected, Testing (with
    /verify-change evidence), Risks, Documentation, ADR, Rollback.
  • /plan-task reports Confidence/Assumptions/Unverified/Human-attention-required.

Phase 3 — Learning

  • /start-task persists context to .ai/context/<TICKET>.json for reuse by
    /plan-task or a fresh session.
  • knowledge/handoffs/ + template for interrupted-task working state,
    surfaced in the generated index.
  • New /capture-learning: after a merge, asks the reflective questions (ADR?
    runbook? command/dependency change? recurring bug? stale docs?), writes
    confirmed items via /write-doc, cleans up handoff/context files.
  • scripts/detect-doc-drift.mjs (non-blocking): systems.yaml/devrig.toml
    mismatches, dangling related/superseded_by ids, docs past their
    review_interval. New /check-knowledge-consistency for the semantic
    checks a script can't do (commands vs package.json, ownership vs
    CODEOWNERS, ADRs vs implementation, etc).

Phase 4 — Intelligence & measurement

  • scripts/generate-architecture-views.mjs builds
    knowledge/generated/{system-map,ownership-map}.md from .ai/*.yaml
    (authority: generated).
  • .ai/runs/<TICKET-ID>/ — a per-task observability trail written
    incrementally by /start-task/plan-task/verify-change
    /raise-pr/capture-learning.
  • evals/ (retrieval/architecture/workflows question sets +
    semble-vs-graphify.md comparison methodology), scored on retrieval
    accuracy, source correctness, token consumption, completeness,
    hallucination rate.
  • (Graphify / per-repo knowledge graphs were already in place before this work.)

Testing

This is a template/tooling repo — no application test suite. Verified by
running the actual scripts against the repo's own state at every step:

  • node scripts/validate-ai-config.mjs — PASS (5/5 .ai/*.yaml files)
  • node scripts/validate-knowledge.mjs — PASS (3 docs)
  • node scripts/detect-doc-drift.mjs — runs clean (4 expected warnings: the
    template's illustrative acme-* vs example-* repo names intentionally
    don't match, demonstrating the drift check works)
  • node scripts/check-adr-requirement.mjs main HEAD — PASS (no protected
    paths touched by this PR)
  • node scripts/build-knowledge-index.mjs / generate-architecture-views.mjs
    — output committed and verified fresh
  • Found and fixed a real bug in scripts/lib/yaml-lite.mjs while writing
    evals/*.yaml (block-sequence items that are multi-key mappings were
    silently truncated) — added regression coverage via the eval files
    themselves parsing correctly.

Risks

  • Machine-readable policy (.ai/policies.yaml) is enforced by CI only for
    the ADR-on-protected-path case; forbidden/approval-required actions and
    agent-role scoping are documented but not yet mechanically enforced —
    called out explicitly in POLICY.md's new "Enforcement status" table so
    it doesn't read as more automated than it is.
  • .ai/systems.yaml/commands.yaml/ownership.yaml still ship with
    illustrative example values (mirroring the existing AGENTS.md TODO
    pattern) — flagged in the Customization checklist, not silently assumed.

Documentation

This PR is documentation/tooling infrastructure — README.md,
knowledge/README.md, AGENTS.md, and POLICY.md were all updated in
place as part of the relevant phase.

ADR

Not required — this PR is the devrig template's own tooling/process
evolution, not a change to a project built on it. (Once a real project adopts
this and runs the Semble-vs-Graphify eval, that verdict should become an ADR.)

Rollback

Revert the merge commit; nothing here touches runtime code or has migration
side effects. The generated files (knowledge/index.md,
knowledge/generated/*.md) regenerate deterministically from source if regenerated post-revert.

…enerated index

Roadmap items 4-6, 10: every knowledge doc now carries structured YAML
frontmatter (status, authority, systems, owners, authorship) instead of a
plain blockquote, so agents can tell what's current vs stale/superseded
without reading the whole doc. knowledge/index.md is generated from that
frontmatter by scripts/build-knowledge-index.mjs, wired into /write-doc's
last step.
Roadmap items 1-3, 7, 21: AGENTS.md now has a Commands table, Definition of
Done pointer, and a concrete Semble retrieval policy (search before
recursively reading, cite sources, prefer canonical docs). POLICY.md is new —
Definition of Done, ADR triggers, verification-evidence and confidence
reporting formats. Machine-enforceable policy (.ai/policies.yaml,
risk-levels.yaml) is deferred to Phase 2, flagged as such.
Roadmap items 8-10: separates the workflow into
start-task (context gathering) -> plan-task (written plan, human gate) ->
implement -> verify-change (evidence per POLICY.md) -> raise-pr, instead of
going straight from ticket to code edits. /raise-pr now points at
/verify-change's evidence before opening a PR.
… PRs

Roadmap Phase 2 (items 1-10):

- .ai/{systems,commands,ownership,policies,risk-levels}.yaml mirror
  AGENTS.md/POLICY.md for tools/CI to parse reliably, validated against
  .ai/schemas/*.schema.json (scripts/validate-ai-config.mjs, no external deps
  — scripts/lib/yaml-lite.mjs + json-schema-lite.mjs).
- scripts/validate-knowledge.mjs checks frontmatter completeness/enum
  validity, canonical-requires-human_reviewed, ADR id/filename consistency,
  broken internal links, and generated-index freshness.
- scripts/check-adr-requirement.mjs fails a PR that touches a protected path
  (.ai/policies.yaml) without an ADR in the same diff.
- .github/workflows/validate.yml and knowledge-check.yml wire both into CI.
- POLICY.md fleshed out: policy areas, forbidden/approval-required actions,
  protected paths, risk levels, data handling, agent roles, and an
  enforcement-status table that's honest about what's still human-only.
- /raise-pr's PR template now includes Systems affected, Testing (with
  /verify-change evidence), Risks, Documentation, ADR, and Rollback sections.
- /plan-task's output now includes a Confidence/Assumptions/Unverified/
  Human-attention-required block.
…ift/consistency checks

Roadmap Phase 3 (items 4-10 in the phase list; 34-40 in the numbered roadmap):

- /start-task now persists gathered context to .ai/context/<TICKET>.json so
  /plan-task (or a fresh session) can reuse it instead of re-running retrieval.
- knowledge/handoffs/ + a handoff template (write-doc) for interrupted-task
  working state; surfaced in the generated index under "Active Handoffs".
- /capture-learning: after a PR merges, asks the reflective questions (ADR?
  runbook? command/dependency change? recurring bug? stale docs?), writes
  what's confirmed via /write-doc, and cleans up the task's handoff/context files.
- scripts/detect-doc-drift.mjs: non-blocking warnings for systems.yaml/
  devrig.toml mismatches, dangling related/superseded_by ids, and docs past
  their (new, optional) `review_interval` frontmatter field. Wired into
  knowledge-check.yml as an informational step.
- /check-knowledge-consistency: semantic pass (commands vs package.json,
  ownership vs CODEOWNERS, architecture vs repos, runbooks vs scripts, API
  docs vs routes, ADRs vs implementation) that the mechanical scripts can't do.
Roadmap Phase 4 (items 43-48 in the numbered roadmap; graphify/knowledge
graphs were already in place from before this project):

- scripts/generate-architecture-views.mjs builds knowledge/generated/
  system-map.md (Mermaid dependency graph) and ownership-map.md from
  .ai/systems.yaml / ownership.yaml, authority: generated. Wired into
  /capture-learning's regenerate step.
- .ai/runs/<TICKET-ID>/ is a per-task observability trail written
  incrementally by /start-task (context.json), /plan-task (plan.md),
  /verify-change (verification.md), /raise-pr (changed-files.txt), and
  /capture-learning (summary.md) — documented in the new .ai/README.md.
- evals/ (retrieval.yaml, architecture.yaml, workflows.yaml,
  semble-vs-graphify.md) — question sets and a comparison methodology,
  scored on retrieval accuracy, source correctness, token consumption,
  answer completeness, and hallucination rate.
- AGENTS.md gets a Context efficiency section, tying the retrieval policy
  to .ai/context/ reuse and the rtk toggle.
- Fixed a real bug in scripts/lib/yaml-lite.mjs: block-sequence items that
  are multi-key mappings (e.g. "- id: x\n  category: y") were silently
  truncated to their first key — only exercised once evals/*.yaml used that
  shape, since .ai/*.yaml's existing sequences are all plain scalars.
…checklist

Found via an end-to-end dry run (create-devrig -> setup.sh) of this PR's
branch: setup.sh's final "Workflow skills available" printout and the
generated project README's "Customize this workspace" checklist still only
listed the original 5 skills / fields, missing /plan-task, /verify-change,
/capture-learning, /check-knowledge-consistency, and the new .ai/*.yaml +
POLICY.md customization steps. CLAUDE.md and this repo's own README.md were
already updated in earlier commits; this script's own output wasn't.
Mirrors the README.md diff from this branch (skills-table row, Customize
this workspace checklist, Layout table) into all 8 translations —
es, fr, hi, ja, ko, pt-BR, si, zh-CN — matching this repo's existing
translation-sync convention (see bd4f1e1 for the same pattern applied to
the graphify feature).
The translation-sync commit introduced 3 table rows using half-width `()`
where the rest of the file consistently uses full-width `()` — a nit
flagged by the fork that did the sync. Also restored a lost trailing pipe
and the .github/workflows/ row that got dropped in my first fix attempt.
@lakpriya1s
lakpriya1s merged commit 414eb1c into main Aug 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant