feat: adopt local SQLite engineering memory and quality gates

This commit is contained in:
2026-11-22 14:39:00 +00:00
parent f5d5db73c2
commit 218c060b94
228 changed files with 28728 additions and 1161 deletions
+57 -26
View File
@@ -17,7 +17,8 @@ Use `ai-engineering` (or its installed alias `aie`). No server or model API is n
payloads, decisions and plan history when relevant; context references are not
the payload itself. Follow the Work guidance. Ask the human for DIRECT or
EXPLORATORY when missing; never infer a choice or approval. Carry a recorded
choice into future sessions. Without a CLI, inspect the portable files directly.
choice into future sessions. SQLite memory requires a compatible CLI. Without it,
read bootstrap guidance and report the tool gap; never infer an empty workspace.
4. Distinguish observations verified now, historical evidence, assumptions and
proposals. Record refinement with `discussion add --text` or `--text-file`,
choosing an explicit `--author`. Resolve questions with RESPONSE/CONCLUSION
@@ -30,7 +31,7 @@ Use `ai-engineering` (or its installed alias `aie`). No server or model API is n
Run `aie project compatibility --format json` before considering an update. `status`
includes a compatibility summary and the diagnostic command. The diagnostic is
read-only: it inspects actual canonical files and record revisions, without locks,
read-only: it inspects actual typed records and their revisions (or legacy files), without locks,
backups, model calls or migrations. It includes AIE completion receipts, while ignored
runs, local backups and ordinary artifact payloads are excluded. Use `project validate`
for integrity.
@@ -54,18 +55,19 @@ rewrite a completed Work merely to materialize current fields, topics or surveys
`aie onboard` refreshes the entry instructions and manifest, with backups, while
leaving Works, evidence and revision history unchanged. A newer unsupported manifest
or contract is refused rather than overwritten; use a compatible CLI. No required
migration is registered in this release. Future conversions must have an explicit
public command, scope, preview, backups and repeatable execution. Do not invent a
migration or inspect AIE source code to discover consumer update procedures; report
public-interface gaps with evidence instead.
or contract is refused rather than overwritten; use a compatible CLI. Legacy reading does not require conversion. `storage migrate --format json` previews
an optional supported legacy-to-SQLite conversion; `--apply --expect HASH` applies
only that reviewed state. Originals and historical hashes/approvals are preserved.
`--recover` or `--rollback` use the operation fingerprint after interruption. Rollback
refuses to lose new SQLite writes. Installation/onboard/reads never migrate storage.
Use the public command and documentation rather than inferring a procedure from code.
The current entry contract is 3 and advertises Work guidance, human DEC requests,
and optional Plan experiments in addition to DF open-agenda import. Contract 1
projects remain readable without Work migration. An import-enabled manifest needs
contract 2 and the `discussion-import` capability; older CLIs must be updated before
reading it. Refresh entry files with `onboard` after compatibility inspection,
preserving historical Works and their approvals.
The current entry contract is 4. It declares SQLite/local memory, quality gates and
temporary artifacts, preserving contract-3 guidance and Plan experiments. Contracts
1, 2 and 3 remain readable on the legacy backend. A SQLite workspace requires the
matching contract 4 and database schema; incompatible combinations are refused.
`init` selects SQLite and adds `/.ai-engineering/` to .gitignore without requiring
Git. `--version-state` leaves ignore policy to the developer; it never untracks files.
## Work conduct and human authority
@@ -208,7 +210,7 @@ the requester. An important child reopening reopens RESULTS ancestors, retaining
history; optional changes do not. Explicit EPIC reopening suspends automatic authority
so replanning is possible; child-caused reopening preserves unchanged-scope authority.
`epic show/check/history` inspects state. `epic reconcile [WRK] --requester NAME
--request-id KEY` recovers missed propagation from files; repeated checks do not
--request-id KEY` recovers missed propagation from persisted state; repeated checks do not
duplicate completion/receipts. Reads never invoke an adapter or perform transitions.
Publication is per file; corrupt records and interrupted orphan publication may still
need deliberate repair. Use public CLI/Verification lifecycle APIs for notification;
@@ -281,8 +283,8 @@ success from a status label. Respect read-only repository policy and the OS sand
## Verification and closure
When the last required step completes, AIE consolidates its Plan and rechecks the
Work's Plans. All required Plans completed, with no pending questions/surveys or
draft DECs, completes the Work automatically. Criteria/results/evidence belong to
Work's Plans. All required Plans completed, with current required gates passed and no pending
questions/surveys or draft DECs, completes the Work automatically. Criteria/results/evidence belong to
the Plans/steps; no new Work-level checklist or model call is required. Completion
records SYSTEM_PLANS origin, humanApproved=false and an owned receipt identifying
the exact Plan revisions. Empty sets and explicit BLOCKED/CANCELLED states remain
@@ -309,7 +311,7 @@ Do not mark COMPLETED through a generic status change. Use disposable test data;
never confuse a historical report with a test run performed now.
Update canonical code, tests, specs and documentation. There is no mandatory Lesson
entity. `work archive` retains all files/history; `work reopen --by NAME --reason TEXT`
entity. `work archive` retains useful memory/history; `work reopen --by NAME --reason TEXT`
allows new evidence and reorientation while retaining earlier completion records.
Never delete history as housekeeping. `import discussion --source ID=PATH` previews
DF DSCs with AGDs open; repeat sources for a multi-project umbrella and use
@@ -321,15 +323,44 @@ are skipped and changed inputs require review without overwriting. Prepared Work
publish individually; after partial publication, preview again to resume without
duplicates. Closed agendas, DECs, Plans and Lessons are not imported.
## Portable files and errors
## Storage, temporary artifacts and errors
SQLite owns operational Work memory in `.ai-engineering/aie.db`. Store typed fields,
prose and relationships, never files encoded as BLOB/base64 or equivalent TEXT.
Small configuration and entry files bootstrap discovery. New revisions and related
references commit in one transaction; related reads share a snapshot. Writer waits
are bounded. RUN application failure rolls back the proposal and separately records
its diagnostic, with no reverted applied references.
Work IDs are uppercase hexadecimal; child IDs are Work-local decimal identifiers.
Discussion and new decision/plan prose use Markdown bodies with versioned YAML front
matter. Use CLI mutations for IDs and references; human-authored prose remains portable.
Revisions live beside their records in `.history`, with SHA-256 links. `.local` stores
locks/backups and is not canonical state. Writes are atomic per file, not across all
records; validation diagnoses interrupted cross-record publication. Preserve backups
and repair deliberately, rather than silently dropping missing references.
Legacy Markdown/YAML and `.history` remain readable on the file backend. Explicit
migration retains original bytes externally when historical hashes need them.
Legacy originals retained in place are not a second writable authority.
Exit codes: 0 success, 1 unexpected I/O/runtime error, 2 invalid input, 3 missing
resource, 4 validation/readiness failure. Read `--help` for exact command options.
Required project gates and additional Work gates are cumulative. Configure with
`gate configure ID --title TEXT --procedure TEXT --input PATH --by NAME`, adding
`--work WRK` for a Work-specific gate and `--require-evidence` when needed. Read
`gate status WRK` to obtain the evaluatedHash before running the procedure externally.
Record the actual result with `gate record WRK project/ID --expect HASH
--invocation TEXT --outcome PASS|FAIL --summary TEXT --by NAME --observed
[--evidence ART]`. Human DEC approval is separate. Files, Work scope/guidance, DEC
revisions or gate-definition changes require current evaluation. Gate history and
delivery snapshots retain the short observed result; the CLI does not execute or
semantically verify repository commands.
Temporary evidence stays on the filesystem while checks need it. Work completion
persists validation before discarding eligible payloads after commit. Context exposes
AVAILABLE, DISCARD_PENDING, DISCARDED, STRUCTURED or RETAINED_LEGACY. Missing input
before a check is an error; retired evidence cannot satisfy a fresh evaluation after
reopening. `artifact recover WRK` finishes interrupted publication/cleanup. Reads do
not clean up or mark checks passed. Unknown residue requires inspection.
New Plan/EPIC receipts are structured database facts, with no extra payload file.
Legacy originals and migration safety copies are preserved. Requested outputs belong
at their delivery destination outside AIE state; cleanup never targets their source.
Raw transport, credentials, environment and complete logs are not retained as memory.
Git synchronization, Git LFS, Work/DEC export and backup as a feature are outside this
local version. The migration safety copy is specifically for conversion recovery.
Exit codes: 0 success, 1 I/O/runtime error, 2 invalid input, 3 missing resource,
4 validation/readiness failure. Read `--help` for exact command options.