Repository navigation
Description
Context
ProPR is getting an Agents feature: a saved, reusable definition that runs on demand or on a schedule and produces a free-form report. An agent run is not a new execution engine — it is one of ProPR's existing isolated task runs (sandboxed checkout, model, tool access, durable task receipt), spawned from a saved definition. An optional, separate acting step hands the report to a second isolated run that uses the ProPR MCP tools to create tasks/TODOs/comments.
Every surface (REST API, MCP, CLI, web UI, worker, daemon scheduler) must agree on the same vocabulary, validation rules and limits. This repository already follows that pattern: packages/shared/src/goalCreation.ts is the single authoritative goal creation contract consumed by the API, MCP, UI and CLI. This first issue creates the equivalent contract for Agents, plus a tiny dependency-free cron evaluator so the scheduler (issue 12), the API (validation and "next run" preview) and the UI all compute the same next run time.
This issue contains no runtime behavior: no database, no routes. It is purely types, constants and pure functions, so it is easy to review and unblocks every following issue.
Requirements
- Add
packages/shared/src/agentDefinitions.tsexporting:AGENT_CAPABILITIES = ['repository_read', 'web', 'propr_mcp'](each separately togglable).AGENT_AUTONOMY_MODES = ['dry_run', 'preview', 'auto'].AGENT_RUN_TRIGGERS = ['manual', 'schedule', 'api', 'mcp', 'cli'].AGENT_RUN_STATEScovering the whole lifecycle:queued,deferred,running,report_ready,awaiting_approval,acting,completed,failed,skipped,rejected,cancelled, plusTERMINAL_AGENT_RUN_STATES.- Interfaces
AgentDefinition,AgentDefinitionInput,AgentRun,AgentRunAttachment. - Limits (name, description, prompt length, max repositories, max attachments, previous-report count and size).
validateAgentDefinitionInput(input, { partial })returning a user-facing error string ornull(same style asvalidateGoalCreationOptions).AGENT_DEFINITION_CONTRACT— a machine-readable description for capability discovery (MCPget_agent_definition_contract, CLI help, UI).isUnattendedTrigger(trigger)—schedule,api,mcp,cliare unattended;manual(UI "Run now") is attended. This drives the cost gate in issue 11.
- Add
packages/shared/src/cronSchedule.tsexporting:parseCronExpression(expr)supporting standard 5-field cron (minute hour day-of-month month day-of-week) with*, lists1,2, ranges1-5, steps*/15and1-30/5, plus the macros@hourly,@daily,@weekly,@monthly.nextCronOccurrence(expr, after: Date): Date— evaluated in UTC only for v1 (documented limitation; timezones are deferred).MIN_AGENT_SCHEDULE_INTERVAL_MINUTES = 15andvalidateAgentSchedule(expr)that rejects schedules firing more often than every 15 minutes (cost guard).
- Re-export both modules from
packages/shared/src/index.ts. - Unit tests in
test/agentDefinitionsContract.test.ts(node:test) for validation and cron evaluation.
Implementation Specification
- Follow
goalCreation.tsconventions: plain functions, no dependencies, user-facing error strings. - Repository handles reuse the
owner/reporegex already used by goals (GOAL_REPOSITORY_PATTERN). propr_mcpcapability is only supported on agent types that can receive an MCP server config at launch (Claude and Codex in v1); exportAGENT_TYPES_SUPPORTING_PROPR_MCPso the API rejects unsupported combinations early (issue 4 validates against the live agent config).- The acting step (autonomy
preview/auto) always runs withpropr_mcp; the report step only gets it when the definition enables it.validateAgentDefinitionInputtherefore does not requirepropr_mcpforauto. - Cron: brute-force minute stepping is fine and simplest to reason about; cap the search at 366 days and throw if no match (e.g.
0 0 31 2 *).
Acceptance Criteria
-
npm run build -w @propr/sharedandnpm run typecheckpass. -
validateAgentDefinitionInputrejects: empty name, >10 repositories, invalid repository format, unknown capability, unknown autonomy mode, schedule more frequent than 15 minutes, malformed cron. -
nextCronOccurrence('*/15 * * * *', 2026-10-06T10:07Z)is10:15Z;@dailyafter2026-10-06T10:00Zis2026-10-07T00:00Z;0 9 * * 1-5skips weekends. -
isUnattendedTrigger('manual') === false, all other triggerstrue. - New test file passes with
node scripts/run-test-suite.mjs test/agentDefinitionsContract.test.ts.
Created by ProPR AI Planner
Activity
propr-dev commentedon Oct 6, 2026
Suggested Implementation:
Implementation Approach
We define the Agents vocabulary once in
@propr/shared(browser-safe, no dependencies) because five different processes need it: the API (REST + MCP validation), the worker (executor), the daemon (scheduler), the CLI and the UI. This mirrors the existinggoalCreation.tscontract, which was introduced precisely so "accepted options cannot drift between entry points".We deliberately write a ~80-line cron evaluator instead of adding
cron-parser: the shared package has zero dependencies and is bundled into the UI, the feature only needs UTC 5-field cron, and a brute-force minute search is trivially correct and testable. Alternatives considered: (a) a library — rejected for bundle/dependency surface; (b) "every N minutes" intervals only — rejected because the request explicitly asks for a "basic cron-like schedule".Key trade-off: v1 evaluates cron in UTC only. Timezone support is a natural follow-up and the stored column (
schedule_timezone, issue 2) leaves room for it.File:
packages/shared/src/agentDefinitions.ts(new file)Why this file: Single source of truth for Agents. Every later issue imports from here so the REST route, MCP schema, CLI parser and UI form validate identically.
File:
packages/shared/src/cronSchedule.ts(new file)Why this file: The scheduler, the API "next run" preview and the UI must compute the same next occurrence. A pure shared function guarantees that.
File:
packages/shared/src/index.tsWhy this file: The barrel is how core, API, CLI and UI import shared contracts.
File:
test/agentDefinitionsContract.test.ts(new file)Why this file: Locks the contract down before five consumers depend on it.
propr-dev commentedon Oct 6, 2026
🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
claudeclaude-opus-5-52800/claude-opus-5-5-agents-v1-1-17-shared-con-20261006-1222-1c12800-epic-agents-v1-y7tissue-2800-20261006-1222-claude-opus-5-5-1c1🔍 Track Task Execution
propr-dev commentedon Oct 6, 2026
🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
claudeclaude-opus-5-52800/claude-opus-5-5-agents-v1-1-17-shared-con-20261006-1235-l6m2800-epic-agents-v1-y7tissue-2800-20261006-1235-claude-opus-5-5-l6m🔍 Track Task Execution
I've added the shared Agents contract and the UTC cron evaluator for …
I've added the shared Agents contract and the UTC cron evaluator for …