Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ A Rails app for engineering design doc review, purpose-built for AI-assisted pla
Most of the application logic lives in the **CoPlan Rails engine** (`engine/`), packaged as the `coplan` gem (path-based, in `Gemfile`). The top-level Rails app is a **thin host** that provides deployment configuration, ActiveAdmin, and app-specific glue.

### Engine (`engine/`) — where the code lives
- **Models** — all domain models live in `engine/app/models/coplan/` (Plan, PlanVersion, User, Comment, CommentThread, EditLease, EditSession, ApiToken, AutomatedPlanReviewer, PlanCollaborator)
- **Models** — all domain models live in `engine/app/models/coplan/` (Plan, PlanVersion, User, Comment, CommentThread, EditLease, EditSession, ApiToken, PlanCollaborator)
- **Controllers** — web UI and API controllers in `engine/app/controllers/coplan/`, including `api/v1/` for the REST API
- **Services** — all service objects in `engine/app/services/coplan/` (Plans::Create, Plans::ApplyOperations, AI providers, etc.)
- **Policies** — authorization policies in `engine/app/policies/coplan/`
Expand Down Expand Up @@ -49,7 +49,7 @@ Most of the application logic lives in the **CoPlan Rails engine** (`engine/`),

## Model Conventions

- Define valid values as **frozen constants** on the model (e.g., `Plan::STATUSES`, `AutomatedPlanReviewer::AI_PROVIDERS`)
- Define valid values as **frozen constants** on the model (e.g., `Plan::STATUSES`, `Comment::AUTHOR_TYPES`)
- Use `inclusion:` validations against those constants
- Use `after_initialize` for defaults on JSON array columns (e.g., `self.tags ||= []`)
- Service objects live in `app/services/` namespaced by model (e.g., `Plans::Create`)
Expand Down Expand Up @@ -80,7 +80,6 @@ Most of the application logic lives in the **CoPlan Rails engine** (`engine/`),

- `db/seeds.rb` must be **idempotent** — use `find_or_create_by!` or guard with count checks
- Seeds should provide enough data to demo features from a fresh checkout
- `AutomatedPlanReviewer.create_defaults_for(org)` handles reviewer seeding

## Code Review

Expand All @@ -98,7 +97,6 @@ Most of the application logic lives in the **CoPlan Rails engine** (`engine/`),
- **Brainstorm** plans are private; **considering+** are published to the org
- **Editing model**: humans comment, AI agents apply edits via semantic operations (`replace_exact`, `insert_under_heading`, `delete_paragraph_containing`)
- **Edit leases**: one agent edits at a time, enforced by a lease with TTL
- **Cloud Personas** (AutomatedPlanReviewers): server-side prompt templates that run as SolidQueue jobs
- **Versions are immutable** — every edit creates a new PlanVersion with full provenance

## Comment & Review UX
Expand Down
31 changes: 0 additions & 31 deletions app/admin/automated_plan_reviewers.rb

This file was deleted.

15 changes: 1 addition & 14 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,4 @@
q3 = CoPlan::Plan.find_by(title: "Q3 Product Roadmap")
q3.tag_names = ["roadmap", "product"] if q3 && q3.tags.empty?

puts "Seeding automated plan reviewers..."
CoPlan::AutomatedPlanReviewer.create_defaults

puts "Done! #{CoPlan::User.count} users, #{CoPlan::Plan.count} plans, #{CoPlan::CommentThread.count} threads, #{CoPlan::Comment.count} comments, #{CoPlan::ApiToken.count} API tokens, #{CoPlan::AutomatedPlanReviewer.count} reviewers."
puts "Done! #{CoPlan::User.count} users, #{CoPlan::Plan.count} plans, #{CoPlan::CommentThread.count} threads, #{CoPlan::Comment.count} comments, #{CoPlan::ApiToken.count} API tokens."
1 change: 0 additions & 1 deletion engine/app/controllers/coplan/api/v1/plans_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def update
before: old_status, after: @plan.status,
actor_type: api_author_type, actor_id: api_actor_id
)
Plans::TriggerAutomatedReviews.call(plan: @plan, new_status: permitted[:status], triggered_by: current_user)
if @plan.status == "considering" && old_status != "considering"
CoPlan::Analytics.track(
"plan_published",
Expand Down
29 changes: 0 additions & 29 deletions engine/app/controllers/coplan/automated_reviews_controller.rb

This file was deleted.

1 change: 0 additions & 1 deletion engine/app/controllers/coplan/plans_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def update_status
before: old_status,
after: new_status
)
Plans::TriggerAutomatedReviews.call(plan: @plan, new_status: new_status, triggered_by: current_user)
if new_status == "considering" && old_status != "considering"
CoPlan::Analytics.track(
"plan_published",
Expand Down
7 changes: 1 addition & 6 deletions engine/app/helpers/coplan/comments_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ module CoPlan
module CommentsHelper
def comment_author_name(comment)
user = comment_author_user(comment)
user_name = user&.name
user_name ||= if comment.author_type == "cloud_persona"
AutomatedPlanReviewer.find_by(id: comment.author_id)&.name || "Reviewer"
else
comment.author_type
end
user_name = user&.name || comment.author_type

comment.agent_name.present? ? "#{comment.agent_name} (via #{user_name})" : user_name
end
Expand Down
71 changes: 0 additions & 71 deletions engine/app/jobs/coplan/automated_review_job.rb

This file was deleted.

62 changes: 0 additions & 62 deletions engine/app/models/coplan/automated_plan_reviewer.rb

This file was deleted.

5 changes: 0 additions & 5 deletions engine/app/services/coplan/ai.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ module CoPlan
# which underlying provider runs the prompt. Use this from any place
# that just wants "an AI" (e.g. SummarizePlanJob).
#
# Provider-specific jobs that need to pin a model or provider per call
# (e.g. AutomatedReviewJob, where each reviewer is configured with its
# own provider+model) should keep calling AiProviders::OpenAi /
# AiProviders::Anthropic directly.
#
# The provider chosen here is an implementation detail; swap it without
# touching callers. Raises CoPlan::Ai::Error on provider failure so
# callers can `discard_on` without knowing which provider is in use.
Expand Down
21 changes: 0 additions & 21 deletions engine/app/services/coplan/ai_providers/anthropic.rb

This file was deleted.

25 changes: 0 additions & 25 deletions engine/app/services/coplan/plans/review_prompt_formatter.rb

This file was deleted.

Loading
Loading