<!-- task=m-iop-agent-cli-runtime/17+13_project_log_records plan=1 tag=API -->

# Stable Project Log Records

## For the Implementing Agent

Fill every implementation-owned section in `CODE_REVIEW-cloud-G08.md`, including actual command output. Keep active files in place and report ready for review; only the review agent finalizes. Record blockers and resume conditions in evidence fields without asking the user or creating control-plane artifacts.

## Background

The standalone host needs a bounded, versioned project-log record before persistence or presentation adapters can safely preserve loop, attempt, and locator identities. This packet owns only that immutable schema and its validation matrix.

## Analysis

### Files Read

- `packages/go/agenttask/ports.go`
- `packages/go/agenttask/types.go`
- `agent-contract/inner/iop-agent-cli-runtime.md`
- `agent-task/m-iop-agent-cli-runtime/17+13_project_log_records/plan_local_G08_0.log`
- `agent-task/m-iop-agent-cli-runtime/17+13_project_log_records/code_review_cloud_G08_0.log`

### SDD Criteria

S12 requires stable project/work/attempt/locator identities and redacted bounded evidence. This strict subset supplies the record schema but does not claim journal, timeline, archive, or `project-logs` completion.

### Verification Context

Use fresh focused tests, vet, formatting, and `git diff --check` from the original plan. No external service or secret is required.

### Test Coverage Gaps

- No concrete `ProjectLogRecord` exists.
- No validation test rejects malformed, oversized, or secret-bearing inputs.

### Symbol References

None. The new types map existing normalized identities without changing `agenttask.EventSink`.

### Split Judgment

API-1 is an independently verifiable producer for the journal and sink packets. It depends only on the standalone host foundation.

### Scope Rationale

Do not implement persistence, CAS retries, archive materialization, event mapping, timeline projection, or the S12 integration matrix.

### Final Routing

- evaluation_mode: `first-pass`
- finalizer: `finalize-task-policy.sh pair`
- build: `local-G08`, basis `local-fit`, filename `PLAN-local-G08.md`
- review: `cloud-G08`, basis `official-review`, filename `CODE_REVIEW-cloud-G08.md`
- large_indivisible_context: `false`
- positive loop risks: `CAS/archive crash windows`, `retry/parallel identity matrix` (count `2`)
- recovery signals: rework `0`, evidence-integrity failure `false`
- capability-gap evidence: none

## Implementation Checklist

- [ ] Define a versioned, bounded ProjectLogRecord and stable project/work/attempt/locator identity schema.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

### [API-1] Define Stable Project Log Records

#### Problem

The standalone contract describes `ProjectLogRecord`, while shared task types contain normalized identities/events, but no concrete bounded record exists.

#### Solution

Add a versioned record with project/work/attempt identity, loop and dispatch ordinals, event type, safe route/quota status, typed locator references, state revision, timestamp, and terminal marker. Validate IDs and cap message/metadata sizes. Never persist credentials, raw environment, or raw provider output.

#### Modified Files and Checklist

- [ ] `apps/agent/internal/projectlog/record.go` — define and validate immutable records and archive manifests.
- [ ] `apps/agent/internal/projectlog/record_test.go` — cover valid, malformed, oversized, and secret-bearing inputs.

#### Test Strategy

Write `TestRecordValidationMatrix` and `TestRecordRejectsSensitiveOrUnboundedFields`.

#### Verification

```bash
go test -count=1 ./apps/agent/internal/projectlog -run 'TestRecord'
```

Expected: normal and boundary matrices pass.

## Dependencies and Execution Order

Predecessor `13_agent_domain` must produce a same-group active or archived `complete.log`. This packet must complete before both project-log consumers.

## Modified Files Summary

| File | Item |
|------|------|
| `apps/agent/internal/projectlog/record.go` | API-1 |
| `apps/agent/internal/projectlog/record_test.go` | API-1 |

## Final Verification

```bash
gofmt -w apps/agent/internal/projectlog/record.go apps/agent/internal/projectlog/record_test.go
go test -count=1 ./apps/agent/internal/projectlog -run 'TestRecord'
go vet ./apps/agent/internal/projectlog
git diff --check
```

Expected: fresh record tests, vet, formatting, and diff checks pass. After completing all changes, fill implementation-owned sections in `CODE_REVIEW-*-G??.md`.
