Files
ai-engineering/docs/requests.md
T
bquarkz 197e77d430
build / jvm (push) Waiting to run
build / native (macos-15, macos-arm64) (push) Waiting to run
build / native (ubuntu-24.04, linux-x86_64) (push) Waiting to run
build / native (windows-2025, windows-x86_64) (push) Waiting to run
Test / Tests and coverage
Intrepid/AI Engineering/pipeline/head This commit looks good
feat: add offline cross-project Requests and Work incorporation
2026-11-23 12:44:38 +00:00

4.9 KiB

Requests between local projects

A Request records a textual demand from one local AIE project for another. Capture works with both servers stopped. It writes one Markdown UTF-8 file to the destination's .ai-engineering/requests/, without opening SQL, starting a server or looking for similar requests. An existing project configuration and write access are required.

Capture

From the source project (or one of its subdirectories):

aie request create "Expose the new parser API" \
  --project /path/to/destination --author source-agent \
  --source-work WRK-000F --text "The source project needs the parser diagnostics."

--project is the required, explicit destination, not the source. It also accepts the destination's .ai-engineering directory. The source project is discovered from the caller's current directory. --source-project /path/to/source overrides that discovery; --source-work is optional and records a reference without querying the source's memory. Specify the actual human or agent with --author.

Use exactly one of --text TEXT or --text-file PATH. Input file paths are relative to the caller's current directory. The body preserves Unicode, indentation, blank lines and trailing newlines. Text must be nonblank; the complete stored document is limited to 1 MiB. Attachments are deferred.

Creation returns the Request and its absolute file path. --format json provides structured output. Files use REQ-<UUID>.md, with YAML front matter for schema and document versions, ID, title, source project, author, creation date and optional source Work. The body contains the original text. There is no shared counter. Publication makes a complete file visible atomically and cannot overwrite another producer's Request. SQL/bootstrap operational records are unchanged.

Discuss and incorporate

At the destination, or with its path supplied through --project:

aie request list
aie request show REQ-00000000-0000-0000-0000-000000000001

These commands use the destination server, starting it through the normal client flow if needed. The human and current AI discuss and group the texts in their ordinary conversation. Nothing analyzes or groups them automatically.

Choose an existing Work or create one using the normal Work commands, with the human's discussion mode and the usual decision authority. Then incorporate each selected Request explicitly:

aie request incorporate REQ-00000000-0000-0000-0000-000000000001 \
  --work WRK-0001 --by destination-agent
aie work context WRK-0001

The original text and provenance become a NOTE in the Work's discussion history, under the thread request:REQ-.... Provenance includes the title, origin, original author/date, optional source Work and SHA-256 of the captured document. The note's author identifies the handler supplied through --by. A later synthesis may complement this note. The full original remains available in Work context after the Request file is removed; no second collection of treated files is retained.

Multiple Requests can be incorporated into the same Work. A Request already incorporated into another Work is a conflict. Incorporation does not transfer source approvals or authorize implementation.

Failure and retry

The Work context commits before file deletion. On SQLite, the note and Work reference share a transaction; an enclosing rollback leaves the input untouched. If persistence fails, the Request remains available. After persistence, cleanup claims the file as .REQ-<UUID>.consuming.md before checking and removing it. A crash leaves this deterministic file discoverable by request list and show.

Repeat request incorporate with the same Request ID and Work after interrupted cleanup. The recorded thread, text and document hash identify the existing context; the operation finishes cleanup without adding a second note. Repeating after successful deletion also returns the previous incorporation with reused: true. Changed input or a different destination Work is reported as a conflict, retaining the remaining file for review. Both a normal file and a recovery file for one ID require explicit inspection; neither is silently overwritten. Reads do not remove files or perform recovery.

Pending Requests remain filesystem inputs rather than SQL records. Incorporation uses ordinary Work discussion storage, including SQL on SQLite projects, without adding a Request table or changing the database schema. The supported legacy backend retains its normal per-file persistence limits.

Native verification

After building the candidate with ./gradlew nativePackage, run:

python3 scripts/native-requests-smoke.py --binary build/native/package/ai-engineering

This creates disposable source/destination projects, checks offline capture leaves the database and server state untouched, incorporates two Requests through the native server, verifies original context and retry behavior, and stops its servers. The full package verifier also runs this scenario.