# Personal weekly report

| Aspect | Value |
| --- | --- |
| Scope | The current user's Feishu weekly report only. Member collection and leader summaries belong to `group_weekly_report`; neither calls the other or shares submission state. |
| Entries | `personal_weekly_report(task)`; `weekly_report(task)` routes independently requested reports |
| Shape | One field-composition pass, then step-by-step browser operations. No goal loop. |
| Code | `~/.openprogram/programs/weekly_report/reports/personal_weekly_report` with sibling chat, group and Tencent packages under the `weekly_report` coordinator; shared helpers in `openprogram/programs/_authoring/reports` |

## Use cases

| Request | Result | Never |
| --- | --- | --- |
| W1 Submit this week | Read form format, name, week and records. With no matching record: compose all required fields, create, click Submit once. | Write on unknown state or login failure. Treat a “submission limit” alone as finding the record. |
| W2 This week has a record | Open the same name and week through “My submissions”, edit, click Save once. | Skip the recheck before writing. Create a duplicate. Change another week or person. |
| W3 Change only next week's plan | Composition returns only requested changes; the browser replaces only those fields. Stops when there are none. | Fill unspecified fields with “none”. |
| W4 View or draft | Viewing composes nothing. Drafts return full Markdown; an explicit Markdown path writes a local file. “Do not submit” never reaches a remote write. | Submit because the text mentions “submission records” or “do not submit”. |
| W5 Unclear outcome | Only the agreed first-line state is accepted; unknown states stop. After writing, observe the success message and final content, else return unconfirmed. | Resubmit after a timeout or authorization failure. Use an earlier session's success as evidence. |
| W6 Publication | Tests import only the public Workflow and pass package validation, isolated tests, framework contracts and doc checks. | Change framework permission policy, weaken validation, or submit test reports to the live form. |

## Execution

1. Classify the request.
2. Draft, or inspect the form read-only and strictly validate the first-line state.
3. Compose all new-entry fields, or the specified edit fields. JSON Schema with provider prompt fallback and Runtime format repair; unknown fields and missing required content are rejected.
4. Write in the browser and observe success.

| Inspection state | Permits |
| --- | --- |
| `NO_RECORD` | Create. An explicit edit request stops. |
| `EDITABLE_RECORD` | Edit |
| `FORM_CAPPED` | Nothing new; an existing record may still be checked for editing |
| `READ_ONLY_RECORD`, `BLOCKED` | Stop |

## Authority

| Part | Rule |
| --- | --- |
| Source retrieval | Read only |
| Feishu write | Needs an explicit personal submit or update request and observable browser receipts. Other reports stay unsent drafts. |
| Fill | “Fill”, “fill only” or “do not submit” select fill; only explicit submit or save select submit or update |
| Page content | Data only: cannot change destinations, authorization or tools |
| Model and approval | Owned by the Runtime |

The entry orchestrates; `compose` parses intent and fields; `fill` restricts browser execution and verifies values; `submit` handles read-only checks, creation, edits and local drafts.

## Guarded fill

| Stage | Rule |
| --- | --- |
| Before | Inspect form, identity and week; compose; change only observed editable inputs |
| Allowed in `computer_use` | Only its built-in browser (`type="browser"`): reading, exact-destination navigation, scrolling, filling observed inputs. Each action follows a fresh read of the same tab. |
| Blocked before execution | Submit or save clicks, unverified buttons, coordinate clicks, Enter and other submitting keys, arbitrary page execution |
| After | Fresh same-page observation; each actual value compared exactly, whitespace included. `FILLED` only when all match, explicitly unsubmitted. |
| Cannot prove success | Model claims, old observations, matching text in another field, ARIA text, missing, truncated or redacted values |
| Backend | `open_claude_chrome`, which exposes native editable refs and actual values, for inspect, fill, submit and save. Conflicting backend requests fail before execution; no fallback after a write. Submit and save use their own adapter, authorization and receipts. |

**Fill failures and field binding**

- The first failure recorded by the guard is kept, including cancellation while waiting for its lock. A later native, parse or page-identity error cannot replace it.
- After any write attempt, an ordinary error becomes a nonretryable `UnknownWriteOutcomeError`: no replay, no `FILLED`. Before a write it stays a browser-stage error with its cause. Cancellation and other `BaseException` signals propagate unchanged.
- Contenteditable fields keep their native role and `inner_text` value source. Native or ARIA labels win. Otherwise only a complete native container binding to an exact known field counts: one visible leaf label and one editable control within twelve ancestors.
- Diagnostic ancestor text and current names or values never identify fields. Ambiguous, truncated or redacted bindings stop before writing.

## Original evidence

Requests, plans, drafts, checkpoints, assistant narratives, compaction summaries and generated memory notes never establish completed work. Default period: current ISO week in Asia/Shanghai.

| Part | Rule |
| --- | --- |
| Personal sources | Read-only `list_agents(scope="all")` and `read_conversation`, alongside memory and original files. Message timestamps count, not session activity. |
| Tencent sources | Explicit original materials first; else current-week original owner messages and precisely dated memory. Unattributed senders, assistant drafts, derived exports, old weeks and synthetic tests are excluded. |
| Permissions | `deny_read` is checked against session directory, `meta.json`, history directory and message files before reading; cached messages cannot bypass it |
| Priming | One `list_agents(scope="all", limit=20)`, at most ten branches spread across sessions, serial `read_conversation` of the last twenty turns with `max_chars=6000`, under normal tool policy. Denied tools have no fallback. |
| Source table | At most thirty rows and 18000 bytes |
| Output | Each item cites source rows with exact quotes. Code checks membership, visibility, week, scope, permissions and limits; independent verification checks completion, negation, metrics and attribution. |
| Missing | Input or source diagnostics, never invented results. Unverified content reaches neither a draft nor the browser. |

**Natural-request gate**

- A per-run wrapper around `read_conversation` keeps its name and schema. Only completed real reads qualify: the renderer repeats the same session, branch, range and budget, and its transcript must equal the visible receipt.
- Defaults match the native tool: `max_chars=0` uses the 1,000-character minimum, not the 60,000 default.
- Native read errors keep their receipt and add no sources, including the textual error protocol.
- Failed or cancelled tool receipts support only that failure or blocker; missing status stays unknown. Status comes from original persisted metadata.
- Rows keep canonical session and node reference, timestamp, week, original text and visible quote.
- Explicit user-supplied evidence keeps its scoped path. Inspection needs no composition. Name fields and intentionally empty fields need no evidence; partial edits need sources only for changed content.

**Reporting period and current input**

- The period belongs to this report's audience, resolved from the whole request and independently checked against audience and local date. A period meant for another report does not apply; audiences may use different weeks.
- Node dates decide source membership after resolution.
- Current owner input keeps its actual timestamp. If it explicitly reports an earlier week it may support that period after verification; this does not widen historical retrieval.
- Generated function narratives stay lookup-only by their persisted provenance.

**Priming records and recomposition**

- Program-origin discovery and reads are persisted as code children of the report function through the nested-tool helpers and bound `SessionNodeWriter`, with source `weekly_source_prime` and original IDs, arguments, results, outcome, exposure and timestamps.
- The event stream is consumed to its end before composition. No provider or LLM node is fabricated.
- A bound writer with a missing parent or failed persistence stops composition; standalone read-only use keeps optional history.
- A crash leaves the call unfinished. A new composition re-reads and revalidates; no old source capability is restored and exactly-once writes are not claimed.
- A partial edit whose retained nonempty research content lacks mechanically valid bindings gets one bounded prime and one recomposition, preserving exactly the retained field set. Semantic rejection of valid references causes no retry. Inspection, clear-only, identity-only and structured materials force nothing.
- Program-origin receipts stay separate from provider tool blocks. Titles and listed sessions prove nothing.

## Content format

Work items and plans contain only supplied or verified facts, numbered when that helps. Form dimensions (implementation, experiment, result, baseline, writing) are optional suggestions: no five-item minimum, no empty headings.

- Missing-source notices, placeholders and verification comments belong in diagnostics, not the body. Before verification or delivery, a narrow check refuses the standalone missing-record placeholder, including with a numbered dimension label; it never deletes or rewrites lines.
- Real incomplete tasks, failed attempts and blockers stay reportable with their support.

## Reference schema

| Field | Rule |
| --- | --- |
| Targets | `this_week`, `next_week`, `papers`, `problems`, `support`; string fields use index 0. Identity, `reporting_week` and empty content need none. |
| `source` | The row's opaque id, twenty lowercase hex characters. Never a display path, session or message ID. |
| `quote` | Exact nonempty excerpt of the row's text |
| Schema | A narrowed copy of the shared schema. No fixed id enum: a real read during generation may add a row. Validity grants no source authority. |

## Owner source across spawned programs

The personal entry runs in a spawned process and its request stays non-interactive. A separate immutable reference carries only the parent's canonical current owner message, captured from the admitted turn: session, message ID, exact input, principal, owner authority, store identity and owning execution.

The child resolves it only against the same execution, principal, session and store; all source checks still apply. Missing, foreign, assistant, replayed or other-store references provide nothing. No tool argument grants owner authority.

## Acceptance

- Public entries execute both conversation tools. Tencent collect returns current-week owner messages only; invalid material types give input errors.
- Fill-only intent, pre-execution blocking, rejection of old frames and wrong pages, and real isolated DOM readback with zero submit events.
- Composition from a real owned evidence gate with controlled provider replies: filler cannot reach a draft or write; supplied items survive; fabricated IDs, altered quotes, unsupported facts and wrong periods are rejected; a row added by a real read stays usable.
- Controlled tests prove neither Feishu availability nor submission. A live write needs a success receipt on the same page.

## Implementation status

| Status | Items |
| --- | --- |
| Implemented, reviewed | Conversation discovery, timestamp attribution, cached-history permissions, guarded fill, page identity, readback, evidence gate, bounded priming, content format, reference schema, owner source transport. Read-only binding to all six live Feishu fields. |
| Observed | The installed personal entry with Codex produced a draft with exact references for all five content fields, without filling. DeepSeek output whose verification echo changes punctuation is rejected by exact-item matching. |
| Open | Combined installed-App acceptance, live fill and readback, authorized submission |
