Commit Graph
273 Commits
Author SHA1 Message Date
ZacharyZhang-NYandClaude Opus 5.5 5698e61e5a Q43: manual runs refuse done tasks and tasks with a session in flight
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 07:47:17 -04:00
ZacharyZhang-NYandClaude Opus 5.5 6a4843a983 Q41: one first-hire rule, and leaders get guidance that fits their rank
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 07:37:02 -04:00
ZacharyZhang-NYandClaude Opus 5.5 7be072f8c5 Q40: tasks choose a writing mode; house style applies to conversational work only
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 07:28:47 -04:00
ZacharyZhang-NYandClaude Opus 5.5 645ce686bb Q39: runs load only model-compatible skills and state each skill's contract
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 07:22:08 -04:00
ZacharyZhang-NYandClaude Opus 5.5 f7530ba65b Q38: the prompt names skill tools the run cannot call, not a fake allowlist
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 07:14:41 -04:00
ZacharyZhang-NYandClaude Opus 5.5 e726c36bac Q37: skill tool text tells the CEO the truth about grants
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 07:11:43 -04:00
ZacharyZhang-NYandClaude Opus 5.5 25d054d954 Q36: retired skills stop loading into runs, cached snapshots included
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 07:06:50 -04:00
ZacharyZhang-NYandClaude Opus 5.5 bbc60cd56a Q35: retired built-in skills come back when the bundle ships them again
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 07:00:57 -04:00
ZacharyZhang-NYandClaude Opus 5.5 da072f9a9b Q34: built-in skill updates reach existing orgs and their bindings
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 06:57:52 -04:00
ZacharyZhang-NYandClaude Opus 5.5 66de4ef015 Q33: document edits and content deletions leave attributed audit records
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 06:45:51 -04:00
ZacharyZhang-NYandClaude Opus 5.5 cb464c3ee4 Q32: documents and knowledge appear in global search
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 06:33:00 -04:00
ZacharyZhang-NYandClaude Opus 5.5 4c475e5ceb Q30: documents keep every version
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 06:10:25 -04:00
ZacharyZhang-NYandClaude Opus 5.5 794fa372c9 Q29: documents record the task that produced them
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 06:02:02 -04:00
ZacharyZhang-NYandClaude Opus 5.5 84fed8e2f2 Q28: agents list, read, and update company documents
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 05:56:55 -04:00
ZacharyZhang-NYandClaude Opus 5.5 ec9d74d128 Q27: knowledge corrections keep a revision history
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 05:51:32 -04:00
ZacharyZhang-NYandClaude Opus 5.5 18128b5ad4 Q26: knowledge has scope, expiry, and supersession
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 05:47:03 -04:00
ZacharyZhang-NYandClaude Opus 5.5 95e607bea7 Q24: knowledge enters the run: search and record tools, relevant entries in prompts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 05:20:03 -04:00
ZacharyZhang-NYandClaude Opus 5.5 0fea8a9159 Q23: command output is bounded while it streams, not after
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 05:11:21 -04:00
ZacharyZhang-NYandClaude Opus 5.5 8e8b66fed4 Q22: cap every tool result and bound connector responses
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 05:04:59 -04:00
ZacharyZhang-NYandClaude Opus 5.5 4d6c74a21e Q21: fetch_url pages long pages and continues where it stopped
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 05:01:28 -04:00
ZacharyZhang-NYandClaude Opus 5.5 1a0da25202 Q20: read_file and read_attachment page by lines, columns, and search
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 04:58:40 -04:00
ZacharyZhang-NYandClaude Opus 5.5 b32e784469 Q19: pack the skills most relevant to the task first
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 04:48:44 -04:00
ZacharyZhang-NYandClaude Opus 5.5 d79fd87077 Q18: every skill, the first included, must fit the skill budget
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 04:42:06 -04:00
ZacharyZhang-NYandClaude Opus 5.5 f4d16eb46a Q17: budget every model request against the provider's context window
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 04:40:02 -04:00
ZacharyZhang-NYandClaude Opus 5.5 f42ab62dbd Q16: compact older tool results inside a run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 04:26:09 -04:00
ZacharyZhang-NYandClaude Opus 5.5 469f2f2c35 Q15: show which messages each agent actually read
Runs record a context manifest once a model turn succeeds; the chat
marks each human message with the agents that read its current version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 04:21:57 -04:00
ZacharyZhang-NYandClaude Opus 5.5 592ce69219 Q14: every human sender shows their own kind and role, board included
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 04:08:21 -04:00
ZacharyZhang-NYandClaude Opus 5.5 31bf0a1497 Q13: messages carry their attachments; agents read them by file_id
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 04:05:11 -04:00
ZacharyZhang-NYandClaude Opus 5.5 f15e47eda1 Q12: read_messages reads threads, pages back, and searches
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 03:59:00 -04:00
ZacharyZhang-NYandClaude Opus 5.5 22632a4695 Q11: deleted messages and withdrawn commands never reach the model
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 03:47:57 -04:00
ZacharyZhang-NYandClaude Opus 5.5 2a7b17a47a Q8: one writing run per workspace directory
Write-granted runs whose directories overlap (same folder, symlink or
junction, or nested) wait for each other, at claim time and for manual
runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 03:25:39 -04:00
ZacharyZhang-NYandClaude Opus 5.5 72eb645067 Q7: an agent runs one session at a time
Claims skip agents that already have a running run, manual runs refuse a
busy agent, a run whose task was reassigned fails before executing, and
tasks with a run in progress cannot be deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 03:11:39 -04:00
ZacharyZhang-NYandClaude Opus 5.5 0fb4ca9ae6 Q6: feed messages that arrive mid-run into the next model turn
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 02:58:54 -04:00
ZacharyZhang-NYandClaude Opus 5.5 fe76f0bc52 Q4: delegated tasks become subtasks of the work that created them
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 02:40:46 -04:00
ZacharyZhang-NYandClaude Opus 5.5 6570492daa Q3: record a structured handoff on every delegated task
create_task now pins upstream files by content hash and carries the
source task, source thread, verified facts, open questions and
acceptance criteria into the assignee's prompt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 02:35:12 -04:00
ZacharyZhang-NYandClaude Opus 5.5 9f2adce7b3 Q2: read_messages lists only mentions the agent has not answered
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 02:25:31 -04:00
ZacharyZhang-NYandClaude Opus 5.5 56b0594f91 Move Composio, logo.dev and Antigravity keys into Settings
The three third-party keys were hardcoded or read from the environment.
Operators now enter them in Settings > Integrations; they are stored
encrypted in the app-wide integration_keys table (migration 058).
An agent holding connector grants fails loudly when no Composio key is
saved. The goal-review test no longer depends on absolute dates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 01:34:14 -04:00
ZacharyZhang-NY aa4cfc056d Human-triggered wakes claim before queued autonomous work
Wake runs stamp sourceSenderType into their secret scope, and the claim
query orders interactive-first: a wake born from an employee or board
message means a person is waiting at the keyboard, so it outranks any
autonomous backlog; within each lane FIFO holds. Non-chat runs carry no
stamp and stay in the autonomous lane. With wake expiry this closes the
live incident: the founder's CEO DM now claims on the next tick instead
of 13th in line. Red-green tested.
2026-07-14 20:46:51 -04:00
ZacharyZhang-NY 39aa292d09 Stale chat wakes expire instead of resuming days later
Live incident: the founder DMed the CEO and got silence — the reply run
sat 13th in a FIFO queue behind chat wakes from four days ago, which the
reopened app was faithfully executing (necro-replies that woke yet more
agents). A wake run is a conversation reply; past one hour the moment is
gone. expireStaleChatWakes (chat-agent-wake-service) fails queued
chat_mention runs older than the TTL and closes their vehicle tasks;
the worker tick runs it before claiming, with one log line. Real work
(heartbeat/kickoff triggers) never expires. Red-green tested.
2026-07-14 20:44:37 -04:00
ZacharyZhang-NY 3c44ff959d Messages pins the founder's CEO conversation at the top
buildConversations learns the org's CEO (c_suite, the runtime predicate)
and ranks the viewer's own direct conversation with them above recency —
counterpart resolution already works from the viewer's seat, so agent-to-
agent CEO chats never match. The row carries a CEO badge and, before the
first exchange, invites asking about progress, goals, or direction.
Being first, it is also the default conversation the page opens on.
2026-07-14 00:16:38 -04:00
ZacharyZhang-NY 4a7fac654e CEO can answer progress and rewrite goals from live data
Two c_suite tools in agent-goal-tools: company_status reports every goal
with real-work task counts (wake tasks and review checkpoints stay out),
work in flight, recent completions, and team headcount, so progress
answers come from the board instead of the model's memory; update_goal
rewrites an active goal's title/description when the founder redirects
the company, audited, CEO-or-owner gated. Both route through the sync
dispatcher; complete_goal now shares the same permission helper.
2026-07-14 00:13:08 -04:00
ZacharyZhang-NY 62ce1570cd Founder-CEO direct conversation is a structural invariant
Every org now keeps one direct chat between the primary employee and the
active c_suite agent: created at onboarding bootstrap (hard failure if
missing), repaired for existing orgs at startup. The existing
wakeDirectCounterparts path already wakes the CEO on every founder
message, so this space is the pinned "talk to your AI CEO" entry the
Messages page will surface next.
2026-07-14 00:07:30 -04:00
ZacharyZhang-NY 0fa99d94a7 Chat-completions turns stream: reasoning models no longer die at the 60s header wall
Root cause of the stuck kimi-for-coding kickoff (task running forever, no
team spawning): runKimiCodeTurn posted stream:false, and a non-streaming
completion returns headers only after the whole generation — once the CEO's
context grew past ~150k chars, a reasoning turn needed >60s and provider-http's
header deadline aborted it ("Provider request timed out."), failing the run;
every heartbeat retry re-read the workspace, regrew the context, and died at
the same wall until the 3-run budget was gone.

Fix at the family level: accumulateChatStream (chat-format.ts) consumes the
standard OpenAI chunk deltas — content appends, indexed tool_call fragments,
reasoning_content keeping the 60s idle deadline fed — and a shared
runChatCompletionsStream drives makeChatCompletionsTurn (kimi, kimi-cn, xai,
groq, mistral, cerebras, openrouter) and runKimiCodeTurn.

Wire shape verified against MoonshotAI/kimi-cli (kosong streams by default)
and a live streamed probe of api.kimi.com/coding/v1 with the stored plan
credential: role opener, reasoning deltas, tool_call fragments (id+name then
argument text), finish_reason, [DONE] — all reassembled correctly.
verify:ci green including e2e.
2026-07-10 23:43:16 -04:00
ZacharyZhang-NY 327de38e78 Kimi Code joins as an OAuth plan provider: RFC 8628 device flow, verified against the live endpoints
- New oauth/kimi-code-flow.ts mirrors the official kimi-cli: form-encoded device_authorization + token polling at auth.kimi.com with the required X-Msh-* device headers, pure poll interpreter, 15-minute tokens refreshed via refresh_token grant
- Agent loop runs chat completions at https://api.kimi.com/coding/v1 with the Bearer access token; default model kimi-for-coding (kimi-for-coding-highspeed for Allegretto+ plans)
- Live model listing via /coding/v1/models; credential refresh wired into the turn credential resolver
- Migration 057 seeds the provider (disabled) into existing organizations
- Wire protocol probed live: device code issued, authorization_pending poll observed, 401 envelope on the coding API confirmed
2026-07-10 17:18:31 -04:00
ZacharyZhang-NY 813276de71 Kimi and Kimi CN join the provider catalog: OpenAI-compatible endpoints, verified live
- kimi -> https://api.moonshot.ai/v1 (platform.kimi.ai keys), kimi-cn -> https://api.moonshot.cn/v1 (platform.kimi.com keys)
- Adapters via openAiCompatibleAdapter; agent loop via makeChatCompletionsTurn; live model listing
- Curated fallback models per current docs: kimi-k2.7-code, kimi-k2.7-code-highspeed, kimi-k2.6
- Migration 056 seeds both providers (disabled) into existing organizations
- Both endpoints probed live: OpenAI-style 401 error envelope confirmed
2026-07-10 17:12:16 -04:00
ZacharyZhang-NY 34ea33cb8d Goal completion is a claim, not a decision: the independent audit
Adopted from studying Claude Code's /goal (completion judged by a fresh
model, never the one doing the work) and pi-goal-x's auditor (isolated
session, read-only tools, explicit approval marker, rejects scaffold-only
and proxy-metric completions).

complete_goal no longer closes a goal on the caller's word:
- It now takes a required `evidence` claim, and permission/argument gates
  run before any audit spend.
- The audit is an isolated tool-turn loop: fresh conversation (the auditor
  never sees the executor's transcript), read-only workspace tools (no
  run_command), strict auditor instructions, at most 6 iterations.
- Only an explicit <approved/> closes the goal (recorded with the audit
  verdict). <disapproved/>, no marker, or an exhausted budget all leave the
  goal active and hand the decisive gap back to the caller as the tool
  result.
- The handler moved from the sync dispatcher into the run loop's async
  routing because it needs provider access; the goal-review prompt warns
  that substanceless claims will bounce.

AGENTS.md documents both this and the web-access contract.
2026-07-09 20:46:53 -04:00
ZacharyZhang-NY 80e70649c3 Every agent gets the live web: web_search and fetch_url by default
"Be ashamed to guess APIs blindly; be proud to look things up carefully" —
until now the agents had no way to look anything up: no search, no fetch,
so market research, API usage, and competitive claims were all invented
from model memory.

agent-web-tools.ts, carried by every agent in every run (same pattern as
the workspace tools, no grant needed):
- web_search: keyless DuckDuckGo HTML backend; parses titles, unwraps the
  /l/?uddg= redirect hrefs, pairs snippets; reports honestly when nothing
  parses instead of fabricating results. Verified against the live endpoint.
- fetch_url: readable-text extraction (dependency-free HTML-to-text with
  entity decoding), 20k-char page cap, 2MB body cap read in chunks, 30s
  timeout.
- SSRF guard on both: hostnames resolve before connecting and loopback,
  private, link-local, CGNAT, and reserved ranges are refused — re-checked
  on every redirect hop, so a public page cannot bounce the agent into
  127.0.0.1 or the cloud metadata address. IPv6 and v4-mapped forms covered.
- The fetcher is injectable, so the test suite covers the guard, redirect
  policy, truncation, extraction, and the DuckDuckGo parser without
  touching the network.
2026-07-09 20:42:12 -04:00
ZacharyZhang-NY 26de3129b1 Goals end at achieved, not at an empty board: the goal-review loop
The board draining to 280/280 done left the company idle under a
still-active goal, with 24 markdown files and zero code as its life's work.
Two structural gaps caused it: goals had no lifecycle (status was written
once as 'active' and never read again — nothing re-engages anyone when the
last task closes), and nothing anywhere distinguished plans from product,
so every "engineering" objective closed on documents.

The loop, closed:
- tasks.origin (migration 055) records provenance: chat_wake for mention
  vehicles (backfilled from their runs), goal_review for checkpoints, null
  for real work. Chatter and checkpoints can therefore never count as
  progress.
- spawnGoalReviews (each worker tick): an active goal with zero open tasks
  and real progress since the last review gets ONE review task for the goal
  owner. The review demands evidence — list the workspace, read the code,
  run the tests; documents are how work starts, not proof it happened — and
  must end in exactly one of: complete_goal, or the next wave of tasks with
  requires_filesystem engineering. A review closed with neither spawns
  nothing: termination is structural, not a counter.
- complete_goal (CEO or goal owner) finally lets someone say a goal is
  achieved, audited.
- CEO and department-head voices now state the doctrine: a goal that
  promises software closes on code that builds and passes tests in the
  workspace, and implementation is delegated with requires_filesystem: true.

On the live profile this arms one review: the active platform goal has 0
open tasks and 21 real completed ones, so the CEO gets the checkpoint on
next launch and the company starts building instead of stopping.
2026-07-09 20:29:42 -04:00
ZacharyZhang-NY 291816aa06 Give agents hands: workspace read/list/exec tools so engineers build instead of describing
Every "engineering" deliverable the company ever produced was a markdown
skeleton, because documentation was the ceiling of the toolset:
write_deliverable and create_document were the only artifact tools. An
engineer could not see the files that exist, read a line of code, or run a
single command — and create_task hardcoded requires_filesystem to false, so
the entire approval-gated read_write mount plumbing was dead code.

New workspace capability (agent-workspace-tools.ts):
- list_files / read_file: explore the bound workspace, traversal-guarded by
  the same resolveWorkspacePath used for writes, size- and count-capped.
- run_command: real shell execution with the workspace as cwd, 120s timeout,
  16k output cap. Gated on the task's approved filesystem grant — the same
  requires_filesystem flag that flips the mount to read_write and routes the
  task through operator approval (auto-approved only in AI-CEO mode, which
  is that mode's explicit contract).
- create_task now takes requires_filesystem, so the CEO and officers can
  delegate engineering work that is allowed to change code and run tests.
- Prompts brief every agent on the tools, and filesystem tasks state the
  bar directly: real output is code that builds and tests that pass — a
  document describing the work does not close an engineering task.

Tests: tool registry, dependency-folder-skipping listing, traversal refusal,
the run_command access gate plus exit-code reporting, and the create_task
approval path for filesystem work.
2026-07-09 19:23:28 -04:00
ZacharyZhang-NY 9c85b5ee3c A task is finished when it reaches done, not when a run ends
The two real goal tasks from July 9 each got exactly one session: the run
completed, the agent never moved the task off backlog, and the heartbeat's
"has a completed run" exclusion locked them out forever. The agents could
not have closed them anyway — update_task_status requires a task_id the
prompt never carried.

The progress contract, made explicit end to end:
- The task prompt now carries "Task id: ..." and tells the agent exactly how
  to end a session: done via update_task_status when the work is complete,
  in_progress with a note on what remains when it is not.
- The heartbeat re-enqueues any open task with no run in flight — a
  completed run that left its task open earns a follow-up session, with the
  prompt stating how many prior sessions were spent so the agent continues
  instead of redoing work. The retry budget (3 non-transient runs) still
  bounds every task; a task that spends it parks with one log line naming it.
- Scripted agents in the integration suites now close their tasks the way
  the contract expects real ones to.
2026-07-09 19:17:44 -04:00