Skip to content

Expose plan types to agents via /agent-instructions#83

Merged
HamptonMakes merged 2 commits intomainfrom
expose-plan-types-to-agents
Apr 6, 2026
Merged

Expose plan types to agents via /agent-instructions#83
HamptonMakes merged 2 commits intomainfrom
expose-plan-types-to-agents

Conversation

@HamptonMakes
Copy link
Copy Markdown
Collaborator

Summary

Exposes plan types to agents so they can create plans with the right type by name.

Changes

  • Agent instructions endpoint — Added a "Plan Types" section listing available types with names and descriptions
  • API: plan_type paramPOST /api/v1/plans now accepts plan_type by name (e.g., "general") instead of requiring a UUID. Returns a clear 422 error listing available types if the name is invalid.
  • Coplan skill — Updated Create Plan docs to show plan_type usage
  • Specs — Added request specs for the agent instructions endpoint and plan type validation

Example error response

{"error": "Unknown plan_type \"nope\". Available types: \"design-doc\", \"general\", \"rfc\"."} 

…ype by name

- Add Plan Types section to agent instructions listing available types
- Accept 'plan_type' param (by name) on plan creation instead of UUID
- Return clear error with available types when an unknown plan_type is given
- Update coplan skill docs to document plan_type param
- Add request specs for agent instructions endpoint

Amp-Thread-ID: https://ampcode.com/threads/T-019d6373-a857-75b8-b976-dc9a989c53e0
Co-authored-by: Amp <amp@ampcode.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4406b5bb7f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

content: params[:content] || "",
user: current_user,
plan_type_id: params[:plan_type_id].presence
plan_type_id: plan_type&.id
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve plan_type_id support in create API

This line makes POST /api/v1/plans persist only plan_type-by-name lookups and drops params[:plan_type_id] entirely, so existing v1 clients that still send plan_type_id now get a 201 response with the plan created without a type instead of the previously expected typed plan (or a 422 for bad IDs). Because the failure is silent, it can skew downstream behavior that depends on plan type (classification/template workflows) and is likely to break older agents during rollout unless you continue accepting plan_type_id (or explicitly reject it).

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Intentional — there are no existing v1 clients using plan_type_id (the field was added in the same development cycle). We're shipping plan_type by name as the only supported path.


### Plan Types

Plan types provide templates and default tags for common plan categories. When creating a plan, pass `plan_type` to use a type's template as the initial content.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove unsupported template fallback claim

The new instructions state that passing plan_type uses the type’s template as initial content, but the create endpoint still sets content from params[:content] || "" and never applies PlanType.template_content. Agents following this guidance and omitting content will create blank plans instead of template-backed drafts, so either implement template fallback in create or adjust this instruction text.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good catch — the docs were inaccurate. Plans::Create doesn't actually fall back to template content. Fixed in 214b580 to say plan types categorize plans and apply default tags, which is what they actually do today.

The docs said plan_type uses template content as initial content, but
Plans::Create doesn't actually do that. Updated to accurately describe
what plan_type does: categorizes the plan and applies default tags.

Amp-Thread-ID: https://ampcode.com/threads/T-019d6373-a857-75b8-b976-dc9a989c53e0
Co-authored-by: Amp <amp@ampcode.com>
@HamptonMakes HamptonMakes merged commit a8675b3 into main Apr 6, 2026
5 checks passed
@HamptonMakes HamptonMakes deleted the expose-plan-types-to-agents branch April 6, 2026 16:02
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.

1 participant