Skip to content

feat(agent): paca-analyst skill that drafts tasks in Refinement - #721

Merged
pikann merged 5 commits into
Paca-AI:masterfrom
msammu07:feature/pm-analyst-skill
Nov 10, 2026
Merged

pikann merged 5 commits into
Paca-AI:masterfrom
msammu07:feature/pm-analyst-skill

Conversation

@msammu07

@msammu07 msammu07 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Second of two PRs for the PM / business analyst agent (part of #719). #720 added the permission model (Refinement status and the Analyst role); this one adds the agent skill that uses it.

What changes:

  • New bundled skill paca-analyst (bundledskills/content/paca-analyst.md): the agent discusses a feature request or bug with the user in plain or technical terms, reads the code, checks the board for overlapping tasks, and writes the result as draft tasks in a refinement-category status for a human to approve. Ground rules: drafts only (it always passes the refinement status id, never the Backlog default), never approves or moves a draft out of Refinement, leaves drafts unassigned and out of sprints, read-only on code, and treats a 403 as final instead of retrying another way. It uses the real Paca MCP tool names (create_task, write_doc, search_tasks, …).
  • Routing: the paca router skill (CLI and agent flavours) lists paca-analyst for requirements and bug triage, and the agent flavour's task-status table routes tasks in Refinement to paca-analyst (keep refining, never move out).
  • Business Analyst agent template (skill_templates.go) points at the bundled skill and recommends giving the agent the project's Analyst role.
  • Docs: docs/ai-agent/pm-agent.md (setup and usage), docs/ai-agent/default-skills.md, docs/README.md and ROADMAP.md.

Type of Change

  • Other (feature: bundled agent skill and routing) + Documentation

Tests

  • TestPacaAnalyst_ToolReferenceNamesRealTools: every Paca tool the skill names exists on the MCP server.
  • TestPacaAgentRouter_RoutesRefinementToAnalyst: the agent router sends Refinement tasks to paca-analyst.
  • Existing bundled-skill catalog tests cover the new entry (agent flavour has no CLI-only text).
  • go build ./... and go test ./internal/... in services/api pass on top of the feat(iam): Refinement drafts and an Analyst role that cannot approve them #720 merge (2e93cee2).

Checklist

  • The change is focused and scoped: skill, routing and docs only; enforcement stays in the IAM role from feat(iam): Refinement drafts and an Analyst role that cannot approve them #720.
  • Related documentation is updated.
  • New structure or direction is explained clearly (docs/ai-agent/pm-agent.md).
  • I avoided unnecessary detail or premature abstraction: reuses the existing bundled-skill catalog and router tables.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The skill, routing and tests look sound, but the persona users actually get from the Business Analyst preset still tells the agent to create_task with no statusId, which the new Analyst role denies — so the documented setup (Business Analyst preset + Analyst role) fails on its first write.

Reviewed changes

  • New paca-analyst bundled skill (bundledskills/content/paca-analyst.md): draft-only PM/BA intake in chat that writes to a refinement-category status, never approves or assigns, and reads code read-only.
  • Catalog and flavour derivation: new catalog entry; the agent flavour is derived (compatibility line → triggers: /paca-analyst, MCP fallback block stripped), covered by the existing flavour tests.
  • Router rows: both paca flavours offer the skill for requirements/bug intake, and the agent flavour's Step 0.5 status table routes Refinement drafts to it.
  • Two new guards: TestPacaAnalyst_ToolReferenceNamesRealTools (every backticked tool in the reference is registered in apps/mcp/src/tools) and TestPacaAgentRouter_RoutesRefinementToAnalyst.
  • Server ba skill template: new "Working in Paca" section pointing at paca-analyst and the Analyst role.
  • Docs: pm-agent.md status → implemented, default-skills.md, docs/README.md index, ROADMAP.md.

I checked the skill against the real MCP schemas and the Analyst-role tests: every tool name, the relates_to/duplicates link types, create_task.statusId, write_doc path handling and each quoted permission guarantee hold.

⚠️ The Business Analyst preset still creates tasks directly, bypassing Refinement

The user-facing preset is AGENT_PRESETS in apps/web/src/lib/agent-api.ts, and its business-analyst defaultSystemPrompt is copied into the agent when the preset is picked (create-agent-dialog.tsx:362-363). That prompt still instructs create_task with type Story/Epic but no statusId, and routing assigned tasks to paca-clarify — exactly what the Analyst role refuses, so a preset agent holding that role gets a 403 on its first create instead of drafting in Refinement. The template this PR did update (skill_templates.go) is served by GET /agents/skill-templates, which the web never reads, so the claim in docs/ai-agent/pm-agent.md:187 that the ba template "defers to paca-analyst so the two do not drift" does not hold for the preset users actually start from.

Technical details
# BA preset bypasses the paca-analyst flow

## Affected sites
- `apps/web/src/lib/agent-api.ts:81-89` — `business-analyst` preset `defaultSystemPrompt` tells the agent to create Story/Epic tasks directly and to skip routing in favour of `paca-clarify`.
- `apps/web/src/components/projects/agents/create-agent-dialog.tsx:344-363` — the preset's prompt is applied to the new agent's system prompt, so this text ships.
- `services/api/internal/service/agent/skill_templates.go:84-86` — the template updated by this PR; only exposed via `GET /agents/skill-templates` (pm-agent.md:185 notes nothing in the web consumes it).

## Required outcome
- An agent created from the Business Analyst preset with the Analyst role behaves like `paca-analyst`: it drafts in the refinement-category status (with `statusId`), never creates backlog tasks, and routes Refinement work to `paca-analyst` rather than `paca-clarify`.
- Either update the preset prompt accordingly, or state explicitly that presets are out of scope and adjust the "do not drift" wording in `pm-agent.md`.

## Suggested approach (optional)
Replace the `business-analyst` preset prompt's create instructions with a deferral mirroring the `skill_templates.go` change (`load_skill`/follow the `paca-analyst` skill; pass the refinement status id; recommend the Analyst role), keeping the existing "skip routing on assignment" sentence consistent with the new skill.

ℹ️ The new /paca-analyst command is missing from the install and command reference

paca-analyst is installed and routable exactly like the other bundled skills, but docs/guides/install-skills.md, which has a ### /paca-<name> section for every command including /paca-role-policy, and the README "Available commands" table do not mention it. Users browsing setup docs will not discover the new workflow, even though docs/ai-agent/pm-agent.md documents it.

Technical details
# Missing command reference entries for /paca-analyst

## Affected sites
- `docs/guides/install-skills.md:118-251` — one section per bundled command; no `/paca-analyst` section.
- `README.md:441-462` — "Available commands" table; no `/paca-analyst` row.

## Required outcome
- A command-reference entry describing `/paca-analyst <idea or bug>`, the Analyst-role prerequisite, and that it drafts in Refinement for human approval.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

The create-agent dialog's Business Analyst preset told the agent to
create Story/Epic tasks with no statusId and to route assigned tasks to
paca-clarify, so a preset agent holding the Analyst role was refused on
its first write. Its prompt now defers to paca-analyst, drafts in the
refinement-category status, and routes assigned tasks to paca-analyst;
the preset description recommends the Analyst role.

paca-analyst: reuse an existing checkout (workspace_prepare's default)
and clone only into an empty directory, since the workspace persists;
quote text evidence in drafts and ask the user to attach files on the
board, since chat has no path to task attachments.

Docs: /paca-analyst in the install guide and README command table, and
pm-agent.md names the preset as well as the ba template.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run reviewed 3d2b5c7, the commit that resolves the prior review's feedback.

  • Business Analyst preset fixed: the AGENT_PRESETS prompt in apps/web/src/lib/agent-api.ts now defers to paca-analyst via load_skill, calls list_task_statuses, and passes the refinement-category status id as statusId on every create_task, so a preset agent holding the Analyst role drafts instead of getting a 403.
  • Command reference added: /paca-analyst <idea or bug> now appears in the README "Available commands" table and as a full section in docs/guides/install-skills.md, including the Analyst-role prerequisite and the draft-only behaviour.
  • Code-read guidance corrected: the skill now tells the agent to workspace_inspect first, call workspace_prepare with the default reuse strategy when a checkout exists, and clone only into an empty directory.
  • Bug-intake evidence corrected: the skill now quotes text evidence pasted in chat and asks the user to attach files/screenshots to the draft on the board, since chat has no attachment path.
  • Docs wording aligned: pm-agent.md now describes the preset and the ba template both deferring to paca-analyst, matching what ships.

I verified the preset's tool names (search_tasks, list_task_statuses, create_task) exist, that list_task_statuses returns Category so the agent can find the refinement status, and that the board supports task attachments. Both inline threads from the prior review are addressed and resolved.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@pikann pikann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for the contribution! 🚀

@pikann
pikann merged commit 223132d into Paca-AI:master Nov 10, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] PM / business analyst agent with human-approved Refinement drafts

2 participants