From 893288a6e450f683c7a11f7fd8c272c82df57cb6 Mon Sep 17 00:00:00 2001 From: amykhar Date: Fri, 14 Nov 2025 07:18:09 -0500 Subject: [PATCH 01/12] Changed the agent name to spec-initializer in the shape spec command --- profiles/default/commands/shape-spec/multi-agent/shape-spec.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/default/commands/shape-spec/multi-agent/shape-spec.md b/profiles/default/commands/shape-spec/multi-agent/shape-spec.md index c83be74b..f69dbe40 100644 --- a/profiles/default/commands/shape-spec/multi-agent/shape-spec.md +++ b/profiles/default/commands/shape-spec/multi-agent/shape-spec.md @@ -16,7 +16,7 @@ Follow each of these phases and their individual workflows IN SEQUENCE: ### PHASE 1: Initialize Spec -Use the **spec-shaper** subagent to initialize a new spec. +Use the **spec-initializer** subagent to initialize a new spec. IF the user has provided a description, provide that to the spec-initializer. From 29e8a6c6b2e836afff75064c8fe94f4deabf7bd8 Mon Sep 17 00:00:00 2001 From: Kamen Zhekov Date: Tue, 2 Dec 2025 09:53:44 +0100 Subject: [PATCH 02/12] Updates verification report file extension Corrects the file extension in the verification report creation guide. It changes the expected file type from .html to .md, aligning it with the actual implementation and improving user guidance. --- .../implementation/verification/create-verification-report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/default/workflows/implementation/verification/create-verification-report.md b/profiles/default/workflows/implementation/verification/create-verification-report.md index f39e2096..2509ef36 100644 --- a/profiles/default/workflows/implementation/verification/create-verification-report.md +++ b/profiles/default/workflows/implementation/verification/create-verification-report.md @@ -1,4 +1,4 @@ -Create your final verification report in `agent-os/specs/[this-spec]/verifications/final-verification.html`. +Create your final verification report in `agent-os/specs/[this-spec]/verifications/final-verification.md`. The content of this report should follow this structure: From 688ea3ddbbcc4c16932749182c0a7f79f86b1cfe Mon Sep 17 00:00:00 2001 From: Perlover Date: Tue, 9 Dec 2025 11:04:15 +0100 Subject: [PATCH 03/12] Add Skill tool to subagents for accessing coding standards and user skills MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on analysis of Claude Code behavior, subagents only receive skill headers when the Skill tool is explicitly listed in their tools. Without it, subagents cannot access any skills - neither Agent OS standards (when installed as skills) nor user's own custom skills. By adding Skill unconditionally to relevant subagents, they can now: - Receive skill headers describing available skills - Decide whether to load and use specific skills based on context - Access user's custom skills regardless of standards_as_claude_code_skills setting Affected subagents: - implementer: primary code implementation agent - spec-writer: creates specifications with architectural decisions - spec-verifier: validates specs against standards - spec-shaper: gathers requirements with awareness of tech stack - tasks-list-creator: plans tasks aligned with coding conventions πŸ€– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- profiles/default/agents/implementer.md | 2 +- profiles/default/agents/spec-shaper.md | 2 +- profiles/default/agents/spec-verifier.md | 2 +- profiles/default/agents/spec-writer.md | 2 +- profiles/default/agents/tasks-list-creator.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/profiles/default/agents/implementer.md b/profiles/default/agents/implementer.md index 242df542..0a2e413a 100644 --- a/profiles/default/agents/implementer.md +++ b/profiles/default/agents/implementer.md @@ -1,7 +1,7 @@ --- name: implementer description: Use proactively to implement a feature by following a given tasks.md for a spec. -tools: Write, Read, Bash, WebFetch, Playwright +tools: Write, Read, Bash, WebFetch, Playwright, Skill color: red model: inherit --- diff --git a/profiles/default/agents/spec-shaper.md b/profiles/default/agents/spec-shaper.md index 9306890c..451490db 100644 --- a/profiles/default/agents/spec-shaper.md +++ b/profiles/default/agents/spec-shaper.md @@ -1,7 +1,7 @@ --- name: spec-shaper description: Use proactively to gather detailed requirements through targeted questions and visual analysis -tools: Write, Read, Bash, WebFetch +tools: Write, Read, Bash, WebFetch, Skill color: blue model: inherit --- diff --git a/profiles/default/agents/spec-verifier.md b/profiles/default/agents/spec-verifier.md index 35d9501d..1e6117a8 100644 --- a/profiles/default/agents/spec-verifier.md +++ b/profiles/default/agents/spec-verifier.md @@ -1,7 +1,7 @@ --- name: spec-verifier description: Use proactively to verify the spec and tasks list -tools: Write, Read, Bash, WebFetch +tools: Write, Read, Bash, WebFetch, Skill color: pink model: sonnet --- diff --git a/profiles/default/agents/spec-writer.md b/profiles/default/agents/spec-writer.md index abe95afd..f0ebf8c7 100644 --- a/profiles/default/agents/spec-writer.md +++ b/profiles/default/agents/spec-writer.md @@ -1,7 +1,7 @@ --- name: spec-writer description: Use proactively to create a detailed specification document for development -tools: Write, Read, Bash, WebFetch +tools: Write, Read, Bash, WebFetch, Skill color: purple model: inherit --- diff --git a/profiles/default/agents/tasks-list-creator.md b/profiles/default/agents/tasks-list-creator.md index 778693f1..d007507f 100644 --- a/profiles/default/agents/tasks-list-creator.md +++ b/profiles/default/agents/tasks-list-creator.md @@ -1,7 +1,7 @@ --- name: task-list-creator description: Use proactively to create a detailed and strategic tasks list for development of a spec -tools: Write, Read, Bash, WebFetch +tools: Write, Read, Bash, WebFetch, Skill color: orange model: inherit --- From 1be88b083cc42285d696002d80de29b8252432c7 Mon Sep 17 00:00:00 2001 From: Brian Casel Date: Tue, 20 Jan 2026 11:23:25 -0500 Subject: [PATCH 04/12] Agent OS v3 release --- CHANGELOG.md | 41 +- README.md | 17 +- commands/agent-os/discover-standards.md | 187 +++ commands/agent-os/index-standards.md | 124 ++ commands/agent-os/inject-standards.md | 291 ++++ commands/agent-os/plan-product.md | 204 +++ commands/agent-os/shape-spec.md | 267 +++ config.yml | 66 +- .../default/agents/implementation-verifier.md | 34 - profiles/default/agents/implementer.md | 19 - profiles/default/agents/product-planner.md | 62 - profiles/default/agents/spec-initializer.md | 11 - profiles/default/agents/spec-shaper.md | 19 - profiles/default/agents/spec-verifier.md | 19 - profiles/default/agents/spec-writer.md | 19 - profiles/default/agents/tasks-list-creator.md | 19 - .../default/claude-code-skill-template.md | 13 - .../create-tasks/multi-agent/create-tasks.md | 40 - .../single-agent/1-get-spec-requirements.md | 21 - .../single-agent/2-create-tasks-list.md | 23 - .../create-tasks/single-agent/create-tasks.md | 9 - .../multi-agent/implement-tasks.md | 55 - .../single-agent/1-determine-tasks.md | 13 - .../single-agent/2-implement-tasks.md | 31 - .../single-agent/3-verify-implementation.md | 19 - .../single-agent/implement-tasks.md | 15 - .../commands/improve-skills/improve-skills.md | 74 - .../orchestrate-tasks/orchestrate-tasks.md | 237 --- .../plan-product/multi-agent/plan-product.md | 36 - .../single-agent/1-product-concept.md | 27 - .../single-agent/2-create-mission.md | 25 - .../single-agent/3-create-roadmap.md | 25 - .../single-agent/4-create-tech-stack.md | 23 - .../plan-product/single-agent/plan-product.md | 18 - .../shape-spec/multi-agent/shape-spec.md | 52 - .../single-agent/1-initialize-spec.md | 15 - .../shape-spec/single-agent/2-shape-spec.md | 35 - .../shape-spec/single-agent/shape-spec.md | 9 - .../write-spec/multi-agent/write-spec.md | 22 - .../write-spec/single-agent/write-spec.md | 23 - profiles/default/global/tech-stack.md | 18 + profiles/default/standards/backend/api.md | 10 - .../default/standards/backend/migrations.md | 9 - profiles/default/standards/backend/models.md | 10 - profiles/default/standards/backend/queries.md | 9 - .../standards/frontend/accessibility.md | 10 - .../default/standards/frontend/components.md | 11 - profiles/default/standards/frontend/css.md | 7 - .../default/standards/frontend/responsive.md | 11 - .../default/standards/global/coding-style.md | 10 - .../default/standards/global/commenting.md | 5 - .../default/standards/global/conventions.md | 11 - .../standards/global/error-handling.md | 9 - .../default/standards/global/tech-stack.md | 31 - .../default/standards/global/validation.md | 11 - .../default/standards/testing/test-writing.md | 9 - .../compile-implementation-standards.md | 28 - .../implementation/create-tasks-list.md | 199 --- .../implementation/implement-tasks.md | 20 - .../create-verification-report.md | 80 - .../verification/run-all-tests.md | 5 - .../verification/update-roadmap.md | 1 - .../verification/verify-tasks.md | 9 - .../planning/create-product-mission.md | 52 - .../planning/create-product-roadmap.md | 47 - .../planning/create-product-tech-stack.md | 20 - .../workflows/planning/gather-product-info.md | 25 - .../specification/initialize-spec.md | 82 - .../workflows/specification/research-spec.md | 262 --- .../workflows/specification/verify-spec.md | 282 ---- .../workflows/specification/write-spec.md | 99 -- scripts/base-install.sh | 701 -------- scripts/common-functions.sh | 1458 ++--------------- scripts/create-profile.sh | 326 ---- scripts/project-install.sh | 715 ++++---- scripts/project-update.sh | 922 ----------- scripts/sync-to-profile.sh | 528 ++++++ 77 files changed, 2104 insertions(+), 6197 deletions(-) create mode 100644 commands/agent-os/discover-standards.md create mode 100644 commands/agent-os/index-standards.md create mode 100644 commands/agent-os/inject-standards.md create mode 100644 commands/agent-os/plan-product.md create mode 100644 commands/agent-os/shape-spec.md delete mode 100644 profiles/default/agents/implementation-verifier.md delete mode 100644 profiles/default/agents/implementer.md delete mode 100644 profiles/default/agents/product-planner.md delete mode 100644 profiles/default/agents/spec-initializer.md delete mode 100644 profiles/default/agents/spec-shaper.md delete mode 100644 profiles/default/agents/spec-verifier.md delete mode 100644 profiles/default/agents/spec-writer.md delete mode 100644 profiles/default/agents/tasks-list-creator.md delete mode 100644 profiles/default/claude-code-skill-template.md delete mode 100644 profiles/default/commands/create-tasks/multi-agent/create-tasks.md delete mode 100644 profiles/default/commands/create-tasks/single-agent/1-get-spec-requirements.md delete mode 100644 profiles/default/commands/create-tasks/single-agent/2-create-tasks-list.md delete mode 100644 profiles/default/commands/create-tasks/single-agent/create-tasks.md delete mode 100644 profiles/default/commands/implement-tasks/multi-agent/implement-tasks.md delete mode 100644 profiles/default/commands/implement-tasks/single-agent/1-determine-tasks.md delete mode 100644 profiles/default/commands/implement-tasks/single-agent/2-implement-tasks.md delete mode 100644 profiles/default/commands/implement-tasks/single-agent/3-verify-implementation.md delete mode 100644 profiles/default/commands/implement-tasks/single-agent/implement-tasks.md delete mode 100644 profiles/default/commands/improve-skills/improve-skills.md delete mode 100644 profiles/default/commands/orchestrate-tasks/orchestrate-tasks.md delete mode 100644 profiles/default/commands/plan-product/multi-agent/plan-product.md delete mode 100644 profiles/default/commands/plan-product/single-agent/1-product-concept.md delete mode 100644 profiles/default/commands/plan-product/single-agent/2-create-mission.md delete mode 100644 profiles/default/commands/plan-product/single-agent/3-create-roadmap.md delete mode 100644 profiles/default/commands/plan-product/single-agent/4-create-tech-stack.md delete mode 100644 profiles/default/commands/plan-product/single-agent/plan-product.md delete mode 100644 profiles/default/commands/shape-spec/multi-agent/shape-spec.md delete mode 100644 profiles/default/commands/shape-spec/single-agent/1-initialize-spec.md delete mode 100644 profiles/default/commands/shape-spec/single-agent/2-shape-spec.md delete mode 100644 profiles/default/commands/shape-spec/single-agent/shape-spec.md delete mode 100644 profiles/default/commands/write-spec/multi-agent/write-spec.md delete mode 100644 profiles/default/commands/write-spec/single-agent/write-spec.md create mode 100644 profiles/default/global/tech-stack.md delete mode 100644 profiles/default/standards/backend/api.md delete mode 100644 profiles/default/standards/backend/migrations.md delete mode 100644 profiles/default/standards/backend/models.md delete mode 100644 profiles/default/standards/backend/queries.md delete mode 100644 profiles/default/standards/frontend/accessibility.md delete mode 100644 profiles/default/standards/frontend/components.md delete mode 100644 profiles/default/standards/frontend/css.md delete mode 100644 profiles/default/standards/frontend/responsive.md delete mode 100644 profiles/default/standards/global/coding-style.md delete mode 100644 profiles/default/standards/global/commenting.md delete mode 100644 profiles/default/standards/global/conventions.md delete mode 100644 profiles/default/standards/global/error-handling.md delete mode 100644 profiles/default/standards/global/tech-stack.md delete mode 100644 profiles/default/standards/global/validation.md delete mode 100644 profiles/default/standards/testing/test-writing.md delete mode 100644 profiles/default/workflows/implementation/compile-implementation-standards.md delete mode 100644 profiles/default/workflows/implementation/create-tasks-list.md delete mode 100644 profiles/default/workflows/implementation/implement-tasks.md delete mode 100644 profiles/default/workflows/implementation/verification/create-verification-report.md delete mode 100644 profiles/default/workflows/implementation/verification/run-all-tests.md delete mode 100644 profiles/default/workflows/implementation/verification/update-roadmap.md delete mode 100644 profiles/default/workflows/implementation/verification/verify-tasks.md delete mode 100644 profiles/default/workflows/planning/create-product-mission.md delete mode 100644 profiles/default/workflows/planning/create-product-roadmap.md delete mode 100644 profiles/default/workflows/planning/create-product-tech-stack.md delete mode 100644 profiles/default/workflows/planning/gather-product-info.md delete mode 100644 profiles/default/workflows/specification/initialize-spec.md delete mode 100644 profiles/default/workflows/specification/research-spec.md delete mode 100644 profiles/default/workflows/specification/verify-spec.md delete mode 100644 profiles/default/workflows/specification/write-spec.md delete mode 100755 scripts/base-install.sh delete mode 100755 scripts/create-profile.sh delete mode 100755 scripts/project-update.sh create mode 100755 scripts/sync-to-profile.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index ebc2df1c..456d5b6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,46 @@ Get notified of major releases by subscribing here: https://buildermethods.com/agent-os +## [3.0] - 2026-01-20 + +Agent OS v3 is a major release that refocuses the framework on what it does bestβ€”establishing and injecting standardsβ€”while deferring to modern AI tools for the parts they now handle better. + +**[Full v3 documentation and video walkthrough β†’](https://buildermethods.com/agent-os)** + +### Why the major version bump? + +AI coding tools have evolved significantly since Agent OS's original release in mid-2025. Claude Code's plan mode, extended thinking, and improved models now handle much of the scaffolding that earlier versions provided: + +- **Spec writing** β€” Now best handled using Plan mode +- **Task breakdown** β€” Tools like Claude Code automatically create and track todo lists +- **Implementation orchestration** β€” Frontier models manage task delegation on their own + +Rather than reinvent these functions, v3 focuses on Agent OS's core strengths: establishing standards, injecting them smartly, and enhancing spec-driven development. + +### What's new in v3 + +**New standards tools:** +- `/discover-standards` β€” Lets the agent surface, suggest, and create standards from your codebase +- `/inject-standards` β€” Injects relevant standards into any context (conversations, plans, Claude Skills) using the new `index.yml` file for automatic detection +- **Sync script** β€” Syncs project standards back to your base profiles + +**Spec workflow changes:** +- Spec creation now defers to **Plan Mode** (Claude Code, Cursor, or any agent with plan mode)β€”the industry-standard approach to spec-driven development in 2026+ +- `/shape-spec` enhances plan mode by prompting targeted questions that consider your standards and product mission, then saves the resulting plan to your Agent OS spec folder + +**Simplified architecture:** +- Profile inheritance now defined in main `config.yml` instead of separate files +- Product planning phase streamlined with AskUserQuestion tool integration +- Implementation/orchestration phases retiredβ€”frontier models handle this well on their own now + +### Backward compatibility + +**Your content stays the same.** Standards, specs, and product docs use the same format and transfer directly to v3. + +**Commands and scripts are new.** The installation process is simpler, but commands are different. Use `/inject-standards` to bake your standards into subagents, Claude Skills, or any prompt you create. + +v2 documentation remains available for those who prefer to stay on v2, but v3 is recommended for all new projects. + ## [2.1.1] - 2025-10-29 - Replaced references to 'spec-researcher' (depreciated agent name) with 'spec-shaper'. @@ -10,7 +50,6 @@ https://buildermethods.com/agent-os - Tightened up template and istructions for writing spec.md, aiming to keep it shorter, easier to scan, and covering only the essentials. - Tweaked create-task-list workflow for consistency. - When planning product roadmap, removed instruction to limit it to 12 items. -- Clarified instructions in implement-tasks in regards to useage of Playwright and screenshots. ## [2.1.0] - 2025-10-21 diff --git a/README.md b/README.md index 175f6b10..9583888e 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,17 @@ agent-os-og -## Your system for spec-driven agentic development. +## Enhance your spec-driven development with smart standards. -[Agent OS](https://buildermethods.com/agent-os) transforms AI coding agents from confused interns into productive developers. With structured workflows that capture your standards, your stack, and the unique details of your codebase, Agent OS gives your agents the specs they need to ship quality code on the first tryβ€”not the fifth. +[Agent OS](https://buildermethods.com/agent-os) captures the tribal knowledge from your codebase and deploys it to your AI coding tools exactly when needed. Document your standards once, then let Agent OS inject the right conventions into the right contextβ€”so every spec and every implementation follows your patterns. -Use it with: +Works alongside Claude Code, Cursor, Antigravity, and other AI tools. Any language, any framework. -βœ… Claude Code, Cursor, or any other AI coding tool. +**Core capabilities:** -βœ… New products or established codebases. - -βœ… Big features, small fixes, or anything in between. - -βœ… Any language or framework. +- **Discover Standards** β€” Extract patterns and conventions from your codebase into documented standards +- **Deploy Standards** β€” Intelligently inject relevant standards based on what you're building +- **Shape Spec** β€” Create better plans that lead to better builds +- **Index Standards** β€” Keep your standards organized and discoverable --- diff --git a/commands/agent-os/discover-standards.md b/commands/agent-os/discover-standards.md new file mode 100644 index 00000000..9dd0c6a0 --- /dev/null +++ b/commands/agent-os/discover-standards.md @@ -0,0 +1,187 @@ +# Discover Standards + +Extract tribal knowledge from your codebase into concise, documented standards. + +## Important Guidelines + +- **Always use AskUserQuestion tool** when asking the user anything +- **Write concise standards** β€” Use minimal words. Standards must be scannable by AI agents without bloating context windows. +- **Offer suggestions** β€” Present options the user can confirm, choose between, or correct. Don't make them think harder than necessary. + +## Process + +### Step 1: Determine Focus Area + +Check if the user specified an area when running this command. If they did, skip to Step 2. + +If no area was specified: + +1. Analyze the codebase structure (folders, file types, patterns) +2. Identify 3-5 major areas. Examples: + - **Frontend areas:** UI components, styling/CSS, state management, forms, routing + - **Backend areas:** API routes, database/models, authentication, background jobs + - **Cross-cutting:** Error handling, validation, testing, naming conventions, file structure +3. Use AskUserQuestion to present the areas: + +``` +I've identified these areas in your codebase: + +1. **API Routes** (src/api/) β€” Request handling, response formats +2. **Database** (src/models/, src/db/) β€” Models, queries, migrations +3. **React Components** (src/components/) β€” UI patterns, props, state +4. **Authentication** (src/auth/) β€” Login, sessions, permissions + +Which area should we focus on for discovering standards? (Pick one, or suggest a different area) +``` + +Wait for user response before proceeding. + +### Step 2: Analyze the Area + +Once an area is determined: + +1. Read key files in that area (5-10 representative files) +2. Look for patterns that are: + - **Unusual or unconventional** β€” Not standard framework/library patterns + - **Opinionated** β€” Specific choices that could have gone differently + - **Tribal** β€” Things a new developer wouldn't know without being told + - **Consistent** β€” Patterns repeated across multiple files + +3. Use AskUserQuestion to present findings: + +``` +I analyzed [area] and found these potential standards worth documenting: + +1. **API Response Envelope** β€” All responses use { success, data, error } structure +2. **Error Codes** β€” Custom error codes like AUTH_001, DB_002 with specific meanings +3. **Pagination Pattern** β€” Cursor-based pagination with consistent param names + +Would you like to document any of these? You can also suggest other standards for this area. + +Options: +- "Yes, all of them" +- "Just 1 and 3" +- "Add: [your suggestion]" +- "Skip this area" +``` + +### Step 3: Deep Dive on Each Standard + +For each standard the user wants to document, ask 1-2 targeted questions to understand the reasoning. Use AskUserQuestion for each. + +Example questions (adapt based on the specific standard): + +- "What problem does this pattern solve? Why not use the default/common approach?" +- "Are there exceptions where this pattern shouldn't be used?" +- "What's the most common mistake a developer or agent makes with this?" + +Keep this brief. The goal is capturing the "why" behind the pattern, not exhaustive documentation. + +### Step 4: Write the Standards + +For each standard: + +1. Determine the appropriate folder (create if needed): + - `api/`, `database/`, `frontend/`, `backend/`, `testing/`, `global/` + +2. Check if a related standard file already exists β€” append to it if so + +3. Draft the content and use AskUserQuestion to confirm: + +``` +Here's the draft for api/response-format.md: + +--- +# API Response Format + +All API responses use this envelope: + +\`\`\`json +{ "success": true, "data": { ... } } +{ "success": false, "error": { "code": "...", "message": "..." } } +\`\`\` + +- Never return raw data without the envelope +- Error responses must include both code and message +- Success responses omit the error field entirely +--- + +Create this file? (yes / edit: [your changes] / skip) +``` + +4. Create or update the file in `agent-os/standards/[folder]/` + +### Step 5: Update the Index + +After all standards are created: + +1. Scan `agent-os/standards/` for all `.md` files +2. For each new file without an index entry, use AskUserQuestion: + +``` +New standard needs an index entry: + File: api/response-format.md + +Suggested description: "API response envelope structure and error format" + +Accept this description? (yes / or type a better one) +``` + +3. Update `agent-os/standards/index.yml`: + +```yaml +api: + response-format: + description: API response envelope structure and error format +``` + +Alphabetize by folder, then by filename. + +### Step 6: Offer to Continue + +Use AskUserQuestion: + +``` +Standards created for [area]: +- api/response-format.md +- api/error-codes.md + +Would you like to discover standards in another area, or are we done? +``` + +## Output Location + +All standards: `agent-os/standards/[folder]/[standard].md` +Index file: `agent-os/standards/index.yml` + +## Writing Concise Standards + +Standards will be injected into AI context windows. Every word costs tokens. Follow these rules: + +- **Lead with the rule** β€” State what to do first, explain why second (if needed) +- **Use code examples** β€” Show, don't tell +- **Skip the obvious** β€” Don't document what the code already makes clear +- **One standard per concept** β€” Don't combine unrelated patterns +- **Bullet points over paragraphs** β€” Scannable beats readable + +**Good:** +```markdown +# Error Responses + +Use error codes: `AUTH_001`, `DB_001`, `VAL_001` + +\`\`\`json +{ "success": false, "error": { "code": "AUTH_001", "message": "..." } } +\`\`\` + +- Always include both code and message +- Log full error server-side, return safe message to client +``` + +**Bad:** +```markdown +# Error Handling Guidelines + +When an error occurs in our application, we have established a consistent pattern for how errors should be formatted and returned to the client. This helps maintain consistency across our API and makes it easier for frontend developers to handle errors appropriately... +[continues for 3 more paragraphs] +``` diff --git a/commands/agent-os/index-standards.md b/commands/agent-os/index-standards.md new file mode 100644 index 00000000..7967c6f7 --- /dev/null +++ b/commands/agent-os/index-standards.md @@ -0,0 +1,124 @@ +# Index Standards + +Rebuild and maintain the standards index file (`index.yml`). + +## Purpose + +The index enables `/inject-standards` to suggest relevant standards without reading all files. It maps each standard to a brief description for quick matching. + +## Process + +### Step 1: Scan for Standards Files + +1. List all `.md` files in `agent-os/standards/` and its subfolders +2. Build a list of all standards organized by folder: + ``` + root/coding-style.md # Files in standards/ root use "root" as the folder name + root/naming.md + api/response-format.md + api/error-handling.md + database/migrations.md + ``` + +**Note:** `root` is a reserved keyword β€” it refers to `.md` files directly in `agent-os/standards/` (not in a subfolder). Do not create an actual folder named "root". + +### Step 2: Load Existing Index + +Read `agent-os/standards/index.yml` if it exists. Note which entries already have descriptions. + +### Step 3: Identify Changes + +Compare the file scan with the existing index: + +- **New files** β€” Standards files without index entries +- **Deleted files** β€” Index entries for files that no longer exist +- **Existing files** β€” Already indexed, keep as-is + +### Step 4: Handle New Files + +For each new standard file that needs an index entry: + +1. Read the file to understand its content +2. Use AskUserQuestion to propose a description: + +``` +New standard needs indexing: + File: api/response-format.md + +Suggested description: "API response envelope structure and error format" + +Accept? (yes / or type a better description) +``` + +Keep descriptions to **one short sentence** β€” they're for matching, not documentation. + +### Step 5: Handle Deleted Files + +If there are index entries for files that no longer exist: + +1. List them for the user +2. Remove them from the index automatically (no confirmation needed) + +Report: "Removed 2 stale index entries: api/old-pattern.md, testing/deprecated.md" + +### Step 6: Write Updated Index + +Generate `agent-os/standards/index.yml` with this structure: + +```yaml +folder-name: + file-name: + description: Brief description here +``` + +**Rules:** +- Alphabetize folders +- Alphabetize files within each folder +- File names without `.md` extension +- One-line descriptions only + +**Example:** +```yaml +root: + coding-style: + description: General coding style, formatting, linting rules + naming: + description: File naming, variable naming, class naming conventions + +api: + error-handling: + description: Error codes, exception handling, error response format + response-format: + description: API response envelope structure, status codes, pagination + +database: + migrations: + description: Migration file structure, naming conventions, rollback patterns +``` + +**Note:** `root` appears first and contains standards files that live directly in `agent-os/standards/` (not in subfolders). + +### Step 7: Report Results + +Summarize what changed: + +``` +Index updated: + βœ“ 2 new entries added + βœ“ 1 stale entry removed + βœ“ 8 entries unchanged + +Total: 9 standards indexed +``` + +## When to Run + +- After manually creating or deleting standards files +- If `/inject-standards` suggestions seem out of sync +- To clean up a messy or outdated index + +**Note:** `/discover-standards` runs this automatically as its final step, so you usually don't need to call it separately after discovering standards. + +## Output + +Updates `agent-os/standards/index.yml` diff --git a/commands/agent-os/inject-standards.md b/commands/agent-os/inject-standards.md new file mode 100644 index 00000000..f7875a61 --- /dev/null +++ b/commands/agent-os/inject-standards.md @@ -0,0 +1,291 @@ +# Inject Standards + +Inject relevant standards into the current context, formatted appropriately for the situation. + +## Usage Modes + +This command supports two modes: + +### Auto-Suggest Mode (no arguments) +``` +/inject-standards +``` +Analyzes context and suggests relevant standards. + +### Explicit Mode (with arguments) +``` +/inject-standards api # All standards in api/ +/inject-standards api/response-format # Single file +/inject-standards api/response-format api/auth # Multiple files +/inject-standards root # All standards in the root folder +/inject-standards root/naming # Single file from root folder +``` +Directly injects specified standards without suggestions. + +**Note:** `root` is a reserved keyword β€” it refers to `.md` files directly in `agent-os/standards/` (not in a subfolder). + +## Process + +### Step 1: Detect Context Scenario + +Before injecting standards, determine which scenario we're in. Read the current conversation and check if we're in plan mode. + +**Three scenarios:** + +1. **Conversation** β€” Regular chat, implementing code, answering questions +2. **Creating a Skill** β€” Building a `.claude/skills/` file +3. **Shaping/Planning** β€” In plan mode, building a spec, running `/shape-spec` + +**Detection logic:** + +- If currently in plan mode OR conversation clearly mentions "spec", "plan", "shape" β†’ **Shaping/Planning** +- If conversation clearly mentions creating a skill, editing `.claude/skills/`, or building a reusable procedure β†’ **Creating a Skill** +- Otherwise β†’ **Ask to confirm** (do not assume) + +**If neither skill nor plan is clearly detected**, use AskUserQuestion to confirm: + +``` +I'll inject the relevant standards. How should I format them? + +1. **Conversation** β€” Read standards into our chat (for implementation work) +2. **Skill** β€” Output file references to include in a skill you're building +3. **Plan** β€” Output file references to include in a plan/spec + +Which scenario? (1, 2, or 3) +``` + +Always ask when uncertain β€” don't assume conversation by default. + +### Step 2: Read the Index (Auto-Suggest Mode) + +Read `agent-os/standards/index.yml` to get the list of available standards and their descriptions. + +If index.yml doesn't exist or is empty: +``` +No standards index found. Run /discover-standards first to create standards, +or /index-standards if you have standards files without an index. +``` + +### Step 3: Analyze Work Context + +Look at the current conversation to understand what the user is working on: +- What type of work? (API, database, UI, etc.) +- What technologies mentioned? +- What's the goal? + +### Step 4: Match and Suggest + +Match index descriptions against the context. Use AskUserQuestion to present suggestions: + +``` +Based on your task, these standards may be relevant: + +1. **api/response-format** β€” API response envelope structure, status codes +2. **api/error-handling** β€” Error codes, exception handling, error responses +3. **global/naming** β€” File naming, variable naming conventions + +Inject these standards? (yes / just 1 and 3 / add: database/migrations / none) +``` + +Keep suggestions focused β€” typically 2-5 standards. Don't overwhelm with too many options. + +### Step 5: Inject Based on Scenario + +Format the output differently based on the detected scenario: + +--- + +#### Scenario: Conversation + +Read the standards and announce them: + +``` +I've read the following standards as they are relevant to what we're working on: + +--- Standard: api/response-format --- + +[full content of the standard file] + +--- End Standard --- + +--- Standard: api/error-handling --- + +[full content of the standard file] + +--- End Standard --- + +**Key points:** +- All API responses use { success, data, error } envelope +- Error codes follow AUTH_xxx, DB_xxx pattern +``` + +--- + +#### Scenario: Creating a Skill + +First, use AskUserQuestion to determine how to include the standards: + +``` +How should these standards be included in your skill? + +1. **References** β€” Add @ file paths that point to the standards (keeps skill lightweight, standards stay in sync) +2. **Copy content** β€” Paste the full standards content into the skill (self-contained, but won't update if standards change) + +Which approach? (1 or 2) +``` + +**If References (option 1):** + +``` +Be sure to include references to the following standards files in the appropriate location in the file(s) that make up this skill: + +@agent-os/standards/api/response-format.md +@agent-os/standards/api/error-handling.md +@agent-os/standards/global/naming.md + +These standards cover: +- API response envelope structure, status codes +- Error codes, exception handling, error responses +- File naming, variable naming conventions +``` + +**If Copy content (option 2):** + +``` +Include the following standards content in your skill: + +--- Standard: api/response-format --- + +[full content of the standard file] + +--- End Standard --- + +--- Standard: api/error-handling --- + +[full content of the standard file] + +--- End Standard --- + +These standards cover: +- API response envelope structure, status codes +- Error codes, exception handling, error responses +- File naming, variable naming conventions +``` + +--- + +#### Scenario: Shaping/Planning + +First, use AskUserQuestion to determine how to include the standards: + +``` +How should these standards be included in your plan? + +1. **References** β€” Add @ file paths that point to the standards (keeps plan lightweight, standards stay in sync) +2. **Copy content** β€” Paste the full standards content into the plan (self-contained, but won't update if standards change) + +Which approach? (1 or 2) +``` + +**If References (option 1):** + +``` +Be sure to include references to the following standards files in the appropriate location in the plan we're building: + +@agent-os/standards/api/response-format.md +@agent-os/standards/api/error-handling.md +@agent-os/standards/global/naming.md + +These standards cover: +- API response envelope structure, status codes +- Error codes, exception handling, error responses +- File naming, variable naming conventions +``` + +**If Copy content (option 2):** + +``` +Include the following standards content in your plan: + +--- Standard: api/response-format --- + +[full content of the standard file] + +--- End Standard --- + +--- Standard: api/error-handling --- + +[full content of the standard file] + +--- End Standard --- + +These standards cover: +- API response envelope structure, status codes +- Error codes, exception handling, error responses +- File naming, variable naming conventions +``` + +--- + +### Step 6: Surface Related Skills (Conversation scenario only) + +When in conversation scenario, check if `.claude/skills/` exists and contains related skills: + +``` +Related Skills you might want to use: +- create-api-endpoint β€” Scaffolds new API endpoints following these standards +``` + +Don't invoke skills automatically β€” just surface them for awareness. + +--- + +## Explicit Mode + +When arguments are provided, skip the suggestion step but still detect scenario. + +### Step 1: Detect Scenario + +Same as auto-suggest mode. + +### Step 2: Parse Arguments + +Arguments can be: +- **Folder name** β€” `api` β†’ inject all `.md` files in `agent-os/standards/api/` +- **Folder/file** β€” `api/response-format` β†’ inject `agent-os/standards/api/response-format.md` +- **Root folder** β€” `root` β†’ inject all `.md` files directly in `agent-os/standards/` (not in subfolders) +- **Root file** β€” `root/naming` β†’ inject `agent-os/standards/naming.md` + +Multiple arguments inject multiple standards. + +### Step 3: Validate + +Check that specified files/folders exist. If not: + +``` +Standard not found: api/nonexistent + +Available standards in api/: +- response-format +- error-handling +- authentication + +Did you mean one of these? +``` + +### Step 4: Inject Based on Scenario + +Same formatting as auto-suggest mode, based on detected scenario. + +--- + +## Tips + +- **Run early** β€” Inject standards at the start of a task, before implementation +- **Be specific** β€” If you know which standards apply, use explicit mode +- **Check the index** β€” If suggestions seem wrong, run `/index-standards` to rebuild +- **Keep standards concise** β€” Injected standards consume tokens; shorter is better + +## Integration + +This command is called internally by `/shape-spec` to inject relevant standards during planning. You can also invoke it directly anytime you need standards in context. diff --git a/commands/agent-os/plan-product.md b/commands/agent-os/plan-product.md new file mode 100644 index 00000000..bd8bf16e --- /dev/null +++ b/commands/agent-os/plan-product.md @@ -0,0 +1,204 @@ +# Plan Product + +Establish foundational product documentation through an interactive conversation. Creates mission, roadmap, and tech stack files in `agent-os/product/`. + +## Important Guidelines + +- **Always use AskUserQuestion tool** when asking the user anything +- **Keep it lightweight** β€” gather enough to create useful docs without over-documenting +- **One question at a time** β€” don't overwhelm with multiple questions + +## Process + +### Step 1: Check for Existing Product Docs + +Check if `agent-os/product/` exists and contains any of these files: +- `mission.md` +- `roadmap.md` +- `tech-stack.md` + +**If any files exist**, use AskUserQuestion: + +``` +I found existing product documentation: +- mission.md: [exists/missing] +- roadmap.md: [exists/missing] +- tech-stack.md: [exists/missing] + +Would you like to: +1. Start fresh (replace all) +2. Update specific files +3. Cancel + +(Choose 1, 2, or 3) +``` + +If option 2, ask which files to update and only gather info for those. +If option 3, stop here. + +**If no files exist**, proceed to Step 2. + +### Step 2: Gather Product Vision (for mission.md) + +Use AskUserQuestion: + +``` +Let's define your product's mission. + +**What problem does this product solve?** + +(Describe the core problem or pain point you're addressing) +``` + +After they respond, use AskUserQuestion: + +``` +**Who is this product for?** + +(Describe your target users or audience) +``` + +After they respond, use AskUserQuestion: + +``` +**What makes your solution unique?** + +(What's the key differentiator or approach?) +``` + +### Step 3: Gather Roadmap (for roadmap.md) + +Use AskUserQuestion: + +``` +Now let's outline your development roadmap. + +**What are the must-have features for launch (MVP)?** + +(List the core features needed for the first usable version) +``` + +After they respond, use AskUserQuestion: + +``` +**What features are planned for after launch?** + +(List features you'd like to add in future phases, or say "none yet") +``` + +### Step 4: Establish Tech Stack (for tech-stack.md) + +First, check if `agent-os/standards/global/tech-stack.md` exists. + +**If the tech-stack standard exists**, read it and use AskUserQuestion: + +``` +I found a tech stack standard in your standards: + +[Summarize the key technologies from global/tech-stack.md] + +Does this project use the same tech stack, or does it differ? + +1. Same as standard (use as-is) +2. Different (I'll specify) + +(Choose 1 or 2) +``` + +If they choose option 1, use the standard's content for tech-stack.md. +If they choose option 2, proceed to ask them to specify (see below). + +**If no tech-stack standard exists** (or they chose option 2 above), use AskUserQuestion: + +``` +**What technologies does this project use?** + +Please describe your tech stack: +- Frontend: (e.g., React, Vue, vanilla JS, or N/A) +- Backend: (e.g., Rails, Node, Django, or N/A) +- Database: (e.g., PostgreSQL, MongoDB, or N/A) +- Other: (hosting, APIs, tools, etc.) +``` + +### Step 5: Generate Files + +Create the `agent-os/product/` directory if it doesn't exist. + +Generate each file based on the information gathered: + +#### mission.md + +```markdown +# Product Mission + +## Problem + +[Insert what problem this product solves - from Step 2] + +## Target Users + +[Insert who this product is for - from Step 2] + +## Solution + +[Insert what makes the solution unique - from Step 2] +``` + +#### roadmap.md + +```markdown +# Product Roadmap + +## Phase 1: MVP + +[Insert must-have features for launch - from Step 3] + +## Phase 2: Post-Launch + +[Insert planned future features - from Step 3, or "To be determined" if they said none yet] +``` + +#### tech-stack.md + +```markdown +# Tech Stack + +[Organize the tech stack information into logical sections] + +## Frontend + +[Frontend technologies, or "N/A" if not applicable] + +## Backend + +[Backend technologies, or "N/A" if not applicable] + +## Database + +[Database choice, or "N/A" if not applicable] + +## Other + +[Other tools, hosting, services - or omit this section if nothing mentioned] +``` + +### Step 6: Confirm Completion + +After creating all files, output to user: + +``` +βœ“ Product documentation created: + + agent-os/product/mission.md + agent-os/product/roadmap.md + agent-os/product/tech-stack.md + +Review these files to ensure they accurately capture your product vision. +You can edit them directly or run /plan-product again to update. +``` + +## Tips + +- If the user provides very brief answers, that's fine β€” the docs can be expanded later +- If they want to skip a section, create the file with a placeholder like "To be defined" +- The `/shape-spec` command will read these files when planning features, so having them populated helps with context diff --git a/commands/agent-os/shape-spec.md b/commands/agent-os/shape-spec.md new file mode 100644 index 00000000..e06d4853 --- /dev/null +++ b/commands/agent-os/shape-spec.md @@ -0,0 +1,267 @@ +# Shape Spec + +Gather context and structure planning for significant work. **Run this command while in plan mode.** + +## Important Guidelines + +- **Always use AskUserQuestion tool** when asking the user anything +- **Offer suggestions** β€” Present options the user can confirm, adjust, or correct +- **Keep it lightweight** β€” This is shaping, not exhaustive documentation + +## Prerequisites + +This command **must be run in plan mode**. + +**Before proceeding, check if you are currently in plan mode.** + +If NOT in plan mode, **stop immediately** and tell the user: + +``` +Shape-spec must be run in plan mode. Please enter plan mode first, then run /shape-spec again. +``` + +Do not proceed with any steps below until confirmed to be in plan mode. + +## Process + +### Step 1: Clarify What We're Building + +Use AskUserQuestion to understand the scope: + +``` +What are we building? Please describe the feature or change. + +(Be as specific as you like β€” I'll ask follow-up questions if needed) +``` + +Based on their response, ask 1-2 clarifying questions if the scope is unclear. Examples: +- "Is this a new feature or a change to existing functionality?" +- "What's the expected outcome when this is done?" +- "Are there any constraints or requirements I should know about?" + +### Step 2: Gather Visuals + +Use AskUserQuestion: + +``` +Do you have any visuals to reference? + +- Mockups or wireframes +- Screenshots of similar features +- Examples from other apps + +(Paste images, share file paths, or say "none") +``` + +If visuals are provided, note them for inclusion in the spec folder. + +### Step 3: Identify Reference Implementations + +Use AskUserQuestion: + +``` +Is there similar code in this codebase I should reference? + +Examples: +- "The comments feature is similar to what we're building" +- "Look at how src/features/notifications/ handles real-time updates" +- "No existing references" + +(Point me to files, folders, or features to study) +``` + +If references are provided, read and analyze them to inform the plan. + +### Step 4: Check Product Context + +Check if `agent-os/product/` exists and contains files. + +If it exists, read key files (like `mission.md`, `roadmap.md`, `tech-stack.md`) and use AskUserQuestion: + +``` +I found product context in agent-os/product/. Should this feature align with any specific product goals or constraints? + +Key points from your product docs: +- [summarize relevant points] + +(Confirm alignment or note any adjustments) +``` + +If no product folder exists, skip this step. + +### Step 5: Surface Relevant Standards + +Read `agent-os/standards/index.yml` to identify relevant standards based on the feature being built. + +Use AskUserQuestion to confirm: + +``` +Based on what we're building, these standards may apply: + +1. **api/response-format** β€” API response envelope structure +2. **api/error-handling** β€” Error codes and exception handling +3. **database/migrations** β€” Migration patterns + +Should I include these in the spec? (yes / adjust: remove 3, add frontend/forms) +``` + +Read the confirmed standards files to include their content in the plan context. + +### Step 6: Generate Spec Folder Name + +Create a folder name using this format: +``` +YYYY-MM-DD-HHMM-{feature-slug}/ +``` + +Where: +- Date/time is current timestamp +- Feature slug is derived from the feature description (lowercase, hyphens, max 40 chars) + +Example: `2026-01-15-1430-user-comment-system/` + +**Note:** If `agent-os/specs/` doesn't exist, create it when saving the spec folder. + +### Step 7: Structure the Plan + +Now build the plan with **Task 1 always being "Save spec documentation"**. + +Present this structure to the user: + +``` +Here's the plan structure. Task 1 saves all our shaping work before implementation begins. + +--- + +## Task 1: Save Spec Documentation + +Create `agent-os/specs/{folder-name}/` with: + +- **plan.md** β€” This full plan +- **shape.md** β€” Shaping notes (scope, decisions, context from our conversation) +- **standards.md** β€” Relevant standards that apply to this work +- **references.md** β€” Pointers to reference implementations studied +- **visuals/** β€” Any mockups or screenshots provided + +## Task 2: [First implementation task] + +[Description based on the feature] + +## Task 3: [Next task] + +... + +--- + +Does this plan structure look right? I'll fill in the implementation tasks next. +``` + +### Step 8: Complete the Plan + +After Task 1 is confirmed, continue building out the remaining implementation tasks based on: +- The feature scope from Step 1 +- Patterns from reference implementations (Step 3) +- Constraints from standards (Step 5) + +Each task should be specific and actionable. + +### Step 9: Ready for Execution + +When the full plan is ready: + +``` +Plan complete. When you approve and execute: + +1. Task 1 will save all spec documentation first +2. Then implementation tasks will proceed + +Ready to start? (approve / adjust) +``` + +## Output Structure + +The spec folder will contain: + +``` +agent-os/specs/{YYYY-MM-DD-HHMM-feature-slug}/ +β”œβ”€β”€ plan.md # The full plan +β”œβ”€β”€ shape.md # Shaping decisions and context +β”œβ”€β”€ standards.md # Which standards apply and key points +β”œβ”€β”€ references.md # Pointers to similar code +└── visuals/ # Mockups, screenshots (if any) +``` + +## shape.md Content + +The shape.md file should capture: + +```markdown +# {Feature Name} β€” Shaping Notes + +## Scope + +[What we're building, from Step 1] + +## Decisions + +- [Key decisions made during shaping] +- [Constraints or requirements noted] + +## Context + +- **Visuals:** [List of visuals provided, or "None"] +- **References:** [Code references studied] +- **Product alignment:** [Notes from product context, or "N/A"] + +## Standards Applied + +- api/response-format β€” [why it applies] +- api/error-handling β€” [why it applies] +``` + +## standards.md Content + +Include the full content of each relevant standard: + +```markdown +# Standards for {Feature Name} + +The following standards apply to this work. + +--- + +## api/response-format + +[Full content of the standard file] + +--- + +## api/error-handling + +[Full content of the standard file] +``` + +## references.md Content + +```markdown +# References for {Feature Name} + +## Similar Implementations + +### {Reference 1 name} + +- **Location:** `src/features/comments/` +- **Relevance:** [Why this is relevant] +- **Key patterns:** [What to borrow from this] + +### {Reference 2 name} + +... +``` + +## Tips + +- **Keep shaping fast** β€” Don't over-document. Capture enough to start, refine as you build. +- **Visuals are optional** β€” Not every feature needs mockups. +- **Standards guide, not dictate** β€” They inform the plan but aren't always mandatory. +- **Specs are discoverable** β€” Months later, someone can find this spec and understand what was built and why. diff --git a/config.yml b/config.yml index b93c982d..74817112 100644 --- a/config.yml +++ b/config.yml @@ -1,56 +1,10 @@ -version: 2.1.1 -base_install: true - - -# CONFIGURATION -# Configure defaults for the tools you use and how Agent OS should compile commands for your projects. - - -# ================================================ -# Do you use Claude Code? -# Set to true to install commands in your project's .claude/commands/agent-os/ folder -# -# Override this default when running project-install.sh by using the flag --claude-code-commands=true/false -# ================================================ -claude_code_commands: true - - -# ================================================ -# Do you use other coding tools (Cursor, Windsurf, etc.)? -# Set to true to install commands in your project's agent-os/commands/ folder -# -# Override this default when running project-install.sh by using the flag --agent-os-commands true/false -# ================================================ -agent_os_commands: false - - -# ================================================ -# Do you want Claude Code to use subagents? -# Set to true to install agents in .claude/agents/agent-os/ and have commands delegate to them -# Requires claude_code_commands: true -# -# Override this default when running project-install.sh by using the flag --use-claude-code-subagents true/false -# ================================================ -use_claude_code_subagents: true - - -# ================================================ -# Should standards be provided to Claude Code as Skills? -# Set to true to use Claude Code's Skills feature for reading standards -# Set to false to inject standards as file references in command prompts -# Requires claude_code_commands: true (automatically treated as false if claude_code_commands is false) -# -# Override this default when running project-install.sh by using the flag --standards-as-claude-code-skills true/false -# ================================================ -standards_as_claude_code_skills: false - - -# ================================================ -# PROFILE -# -# Use this profile by default. -# -# Override this default when running project-install.sh by using the flag --profile [profile-name] -# ================================================ - -profile: default +version: 3.0 +default_profile: test-profile + +# Optional: define inheritance relationships for profiles +# Profiles not listed here still work, they just have no inheritance +profiles: + test-profile: + inherits_from: mid-profile + mid-profile: + inherits_from: base-profile diff --git a/profiles/default/agents/implementation-verifier.md b/profiles/default/agents/implementation-verifier.md deleted file mode 100644 index ddf1e60d..00000000 --- a/profiles/default/agents/implementation-verifier.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -name: implementation-verifier -description: Use proactively to verify the end-to-end implementation of a spec -tools: Write, Read, Bash, WebFetch, Playwright -color: green -model: inherit ---- - -You are a product spec verifier responsible for verifying the end-to-end implementation of a spec, updating the product roadmap (if necessary), and producing a final verification report. - -## Core Responsibilities - -1. **Ensure tasks.md has been updated**: Check this spec's `tasks.md` to ensure all tasks and sub-tasks have been marked complete with `- [x]` -2. **Update roadmap (if applicable)**: Check `agent-os/product/roadmap.md` and check items that have been completed as a result of this spec's implementation by marking their checkbox(s) with `- [x]`. -3. **Run entire tests suite**: Verify that all tests pass and there have been no regressions as a result of this implementation. -4. **Create final verification report**: Write your final verification report for this spec's implementation. - -## Workflow - -### Step 1: Ensure tasks.md has been updated - -{{workflows/implementation/verification/verify-tasks}} - -### Step 2: Update roadmap (if applicable) - -{{workflows/implementation/verification/update-roadmap}} - -### Step 3: Run entire tests suite - -{{workflows/implementation/verification/run-all-tests}} - -### Step 4: Create final verification report - -{{workflows/implementation/verification/create-verification-report}} diff --git a/profiles/default/agents/implementer.md b/profiles/default/agents/implementer.md deleted file mode 100644 index 0a2e413a..00000000 --- a/profiles/default/agents/implementer.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: implementer -description: Use proactively to implement a feature by following a given tasks.md for a spec. -tools: Write, Read, Bash, WebFetch, Playwright, Skill -color: red -model: inherit ---- - -You are a full stack software developer with deep expertise in front-end, back-end, database, API and user interface development. Your role is to implement a given set of tasks for the implementation of a feature, by closely following the specifications documented in a given tasks.md, spec.md, and/or requirements.md. - -{{workflows/implementation/implement-tasks}} - -{{UNLESS standards_as_claude_code_skills}} -## User Standards & Preferences Compliance - -IMPORTANT: Ensure that the tasks list you create IS ALIGNED and DOES NOT CONFLICT with any of user's preferred tech stack, coding conventions, or common patterns as detailed in the following files: - -{{standards/*}} -{{ENDUNLESS standards_as_claude_code_skills}} diff --git a/profiles/default/agents/product-planner.md b/profiles/default/agents/product-planner.md deleted file mode 100644 index 12c52f74..00000000 --- a/profiles/default/agents/product-planner.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -name: product-planner -description: Use proactively to create product documentation including mission, and roadmap -tools: Write, Read, Bash, WebFetch -color: cyan -model: inherit ---- - -You are a product planning specialist. Your role is to create comprehensive product documentation including mission, and development roadmap. - -# Product Planning - -## Core Responsibilities - -1. **Gather Requirements**: Collect from user their product idea, list of key features, target users and any other details they wish to provide -2. **Create Product Documentation**: Generate mission, and roadmap files -3. **Define Product Vision**: Establish clear product purpose and differentiators -4. **Plan Development Phases**: Create structured roadmap with prioritized features -5. **Document Product Tech Stack**: Document the tech stack used on all aspects of this product's codebase - -## Workflow - -### Step 1: Gather Product Requirements - -{{workflows/planning/gather-product-info}} - -### Step 2: Create Mission Document - -{{workflows/planning/create-product-mission}} - -### Step 3: Create Development Roadmap - -{{workflows/planning/create-product-roadmap}} - -### Step 4: Document Tech Stack - -{{workflows/planning/create-product-tech-stack}} - -### Step 5: Final Validation - -Verify all files created successfully: - -```bash -# Validate all product files exist -for file in mission.md roadmap.md; do - if [ ! -f "agent-os/product/$file" ]; then - echo "Error: Missing $file" - else - echo "βœ“ Created agent-os/product/$file" - fi -done - -echo "Product planning complete! Review your product documentation in agent-os/product/" -``` - -{{UNLESS standards_as_claude_code_skills}} -## User Standards & Preferences Compliance - -IMPORTANT: Ensure the product mission and roadmap are ALIGNED and DO NOT CONFLICT with the user's preferences and standards as detailed in the following files: - -{{standards/global/*}} -{{ENDUNLESS standards_as_claude_code_skills}} diff --git a/profiles/default/agents/spec-initializer.md b/profiles/default/agents/spec-initializer.md deleted file mode 100644 index ac8ec04b..00000000 --- a/profiles/default/agents/spec-initializer.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: spec-initializer -description: Use proactively to initialize spec folder and save raw idea -tools: Write, Bash -color: green -model: sonnet ---- - -You are a spec initialization specialist. Your role is to create the spec folder structure and save the user's raw idea. - -{{workflows/specification/initialize-spec}} diff --git a/profiles/default/agents/spec-shaper.md b/profiles/default/agents/spec-shaper.md deleted file mode 100644 index 451490db..00000000 --- a/profiles/default/agents/spec-shaper.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: spec-shaper -description: Use proactively to gather detailed requirements through targeted questions and visual analysis -tools: Write, Read, Bash, WebFetch, Skill -color: blue -model: inherit ---- - -You are a software product requirements research specialist. Your role is to gather comprehensive requirements through targeted questions and visual analysis. - -{{workflows/specification/research-spec}} - -{{UNLESS standards_as_claude_code_skills}} -## User Standards & Preferences Compliance - -IMPORTANT: Ensure that all of your questions and final documented requirements ARE ALIGNED and DO NOT CONFLICT with any of user's preferred tech-stack, coding conventions, or common patterns as detailed in the following files: - -{{standards/*}} -{{ENDUNLESS standards_as_claude_code_skills}} diff --git a/profiles/default/agents/spec-verifier.md b/profiles/default/agents/spec-verifier.md deleted file mode 100644 index 1e6117a8..00000000 --- a/profiles/default/agents/spec-verifier.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: spec-verifier -description: Use proactively to verify the spec and tasks list -tools: Write, Read, Bash, WebFetch, Skill -color: pink -model: sonnet ---- - -You are a software product specifications verifier. Your role is to verify the spec and tasks list. - -{{workflows/specification/verify-spec}} - -{{UNLESS standards_as_claude_code_skills}} -## User Standards & Preferences Compliance - -IMPORTANT: Ensure that the spec and tasks list are ALIGNED and DO NOT CONFLICT with any of user's preferred tech stack, coding conventions, or common patterns as detailed in the following files: - -{{standards/*}} -{{ENDUNLESS standards_as_claude_code_skills}} diff --git a/profiles/default/agents/spec-writer.md b/profiles/default/agents/spec-writer.md deleted file mode 100644 index f0ebf8c7..00000000 --- a/profiles/default/agents/spec-writer.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: spec-writer -description: Use proactively to create a detailed specification document for development -tools: Write, Read, Bash, WebFetch, Skill -color: purple -model: inherit ---- - -You are a software product specifications writer. Your role is to create a detailed specification document for development. - -{{workflows/specification/write-spec}} - -{{UNLESS standards_as_claude_code_skills}} -## User Standards & Preferences Compliance - -IMPORTANT: Ensure that the spec you create IS ALIGNED and DOES NOT CONFLICT with any of user's preferred tech stack, coding conventions, or common patterns as detailed in the following files: - -{{standards/*}} -{{ENDUNLESS standards_as_claude_code_skills}} diff --git a/profiles/default/agents/tasks-list-creator.md b/profiles/default/agents/tasks-list-creator.md deleted file mode 100644 index d007507f..00000000 --- a/profiles/default/agents/tasks-list-creator.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: task-list-creator -description: Use proactively to create a detailed and strategic tasks list for development of a spec -tools: Write, Read, Bash, WebFetch, Skill -color: orange -model: inherit ---- - -You are a software product tasks list writer and planner. Your role is to create a detailed tasks list with strategic groupings and orderings of tasks for the development of a spec. - -{{workflows/implementation/create-tasks-list}} - -{{UNLESS standards_as_claude_code_skills}} -## User Standards & Preferences Compliance - -IMPORTANT: Ensure that the tasks list you create IS ALIGNED and DOES NOT CONFLICT with any of user's preferred tech stack, coding conventions, or common patterns as detailed in the following files: - -{{standards/*}} -{{ENDUNLESS standards_as_claude_code_skills}} diff --git a/profiles/default/claude-code-skill-template.md b/profiles/default/claude-code-skill-template.md deleted file mode 100644 index 9fba1fe4..00000000 --- a/profiles/default/claude-code-skill-template.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -name: {{standard_name_humanized_capitalized}} -description: Your approach to handling {{standard_name_humanized}}. Use this skill when working on files where {{standard_name_humanized}} comes into play. ---- - -# {{standard_name_humanized_capitalized}} - -This Skill provides Claude Code with specific guidance on how to adhere to coding standards as they relate to how it should handle {{standard_name_humanized}}. - -## Instructions - -For details, refer to the information provided in this file: -[{{standard_name_humanized}}](../../../{{standard_file_path}}) diff --git a/profiles/default/commands/create-tasks/multi-agent/create-tasks.md b/profiles/default/commands/create-tasks/multi-agent/create-tasks.md deleted file mode 100644 index bf6ac232..00000000 --- a/profiles/default/commands/create-tasks/multi-agent/create-tasks.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task List Creation Process - -You are creating a tasks breakdown from a given spec and requirements for a new feature. - -## PHASE 1: Get and read the spec.md and/or requirements document(s) - -You will need ONE OR BOTH of these files to inform your tasks breakdown: -- `agent-os/specs/[this-spec]/spec.md` -- `agent-os/specs/[this-spec]/planning/requirements.md` - -IF you don't have ONE OR BOTH of those files in your current conversation context, then ask user to provide direction on where to you can find them by outputting the following request then wait for user's response: - -``` -I'll need a spec.md or requirements.md (or both) in order to build a tasks list. - -Please direct me to where I can find those. If you haven't created them yet, you can run /shape-spec or /write-spec. -``` - -## PHASE 2: Create tasks.md - -Once you have `spec.md` AND/OR `requirements.md`, use the **tasks-list-creator** subagent to break down the spec and requirements into an actionable tasks list with strategic grouping and ordering. - -Provide the tasks-list-creator: -- `agent-os/specs/[this-spec]/spec.md` (if present) -- `agent-os/specs/[this-spec]/planning/requirements.md` (if present) -- `agent-os/specs/[this-spec]/planning/visuals/` and its' contents (if present) - -The tasks-list-creator will create `tasks.md` inside the spec folder. - -## PHASE 3: Inform user - -Once the tasks-list-creator has created `tasks.md` output the following to inform the user: - -``` -Your tasks list ready! - -βœ… Tasks list created: `agent-os/specs/[this-spec]/tasks.md` - -NEXT STEP πŸ‘‰ Run `/implement-tasks` (simple, effective) or `/orchestrate-tasks` (advanced, powerful) to start building! -``` diff --git a/profiles/default/commands/create-tasks/single-agent/1-get-spec-requirements.md b/profiles/default/commands/create-tasks/single-agent/1-get-spec-requirements.md deleted file mode 100644 index d056a531..00000000 --- a/profiles/default/commands/create-tasks/single-agent/1-get-spec-requirements.md +++ /dev/null @@ -1,21 +0,0 @@ -The FIRST STEP is to make sure you have ONE OR BOTH of these files to inform your tasks breakdown: -- `agent-os/specs/[this-spec]/spec.md` -- `agent-os/specs/[this-spec]/planning/requirements.md` - -IF you don't have ONE OR BOTH of those files in your current conversation context, then ask user to provide direction on where to you can find them by outputting the following request then wait for user's response: - -"I'll need a spec.md or requirements.md (or both) in order to build a tasks list. - -Please direct me to where I can find those. If you haven't created them yet, you can run /shape-spec or /write-spec." - -{{UNLESS compiled_single_command}} -## Display confirmation and next step - -Once you've confirmed you have the spec and/or requirements, output the following message (replace `[this-spec]` with the folder name for this spec) - -``` -βœ… I have the spec and requirements `[spec and requirements path]`. - -NEXT STEP πŸ‘‰ Run the command, 2-create-tasks-list.md -``` -{{ENDUNLESS compiled_single_command}} diff --git a/profiles/default/commands/create-tasks/single-agent/2-create-tasks-list.md b/profiles/default/commands/create-tasks/single-agent/2-create-tasks-list.md deleted file mode 100644 index da47f2dd..00000000 --- a/profiles/default/commands/create-tasks/single-agent/2-create-tasks-list.md +++ /dev/null @@ -1,23 +0,0 @@ -Now that you have the spec.md AND/OR requirements.md, please break those down into an actionable tasks list with strategic grouping and ordering, by following these instructions: - -{{workflows/implementation/create-tasks-list}} - -## Display confirmation and next step - -Display the following message to the user: - -``` -The tasks list has created at `agent-os/specs/[this-spec]/tasks.md`. - -Review it closely to make sure it all looks good. - -NEXT STEP πŸ‘‰ Run `/implement-tasks` (simple, effective) or `/orchestrate-tasks` (advanced, powerful) to start building! -``` - -{{UNLESS standards_as_claude_code_skills}} -## User Standards & Preferences Compliance - -IMPORTANT: Ensure that the tasks list is ALIGNED and DOES NOT CONFLICT with the user's preferences and standards as detailed in the following files: - -{{standards/*}} -{{ENDUNLESS standards_as_claude_code_skills}} diff --git a/profiles/default/commands/create-tasks/single-agent/create-tasks.md b/profiles/default/commands/create-tasks/single-agent/create-tasks.md deleted file mode 100644 index 303872c7..00000000 --- a/profiles/default/commands/create-tasks/single-agent/create-tasks.md +++ /dev/null @@ -1,9 +0,0 @@ -I want you to create a tasks breakdown from a given spec and requirements for a new feature using the following MULTI-PHASE process and instructions. - -Carefully read and execute the instructions in the following files IN SEQUENCE, following their numbered file names. Only proceed to the next numbered instruction file once the previous numbered instruction has been executed. - -Instructions to follow in sequence: - -{{PHASE 1: @agent-os/commands/create-tasks/1-get-spec-requirements.md}} - -{{PHASE 2: @agent-os/commands/create-tasks/2-create-tasks-list.md}} diff --git a/profiles/default/commands/implement-tasks/multi-agent/implement-tasks.md b/profiles/default/commands/implement-tasks/multi-agent/implement-tasks.md deleted file mode 100644 index f5db2775..00000000 --- a/profiles/default/commands/implement-tasks/multi-agent/implement-tasks.md +++ /dev/null @@ -1,55 +0,0 @@ -# Spec Implementation Process - -Now that we have a spec and tasks list ready for implementation, we will proceed with implementation of this spec by following this multi-phase process: - -PHASE 1: Determine which task group(s) from tasks.md should be implemented -PHASE 2: Delegate implementation to the implementer subagent -PHASE 3: After ALL task groups have been implemented, delegate to implementation-verifier to produce the final verification report. - -Follow each of these phases and their individual workflows IN SEQUENCE: - -## Multi-Phase Process - -### PHASE 1: Determine which task group(s) to implement - -First, check if the user has already provided instructions about which task group(s) to implement. - -**If the user HAS provided instructions:** Proceed to PHASE 2 to delegate implementation of those specified task group(s) to the **implementer** subagent. - -**If the user has NOT provided instructions:** - -Read `agent-os/specs/[this-spec]/tasks.md` to review the available task groups, then output the following message to the user and WAIT for their response: - -``` -Should we proceed with implementation of all task groups in tasks.md? - -If not, then please specify which task(s) to implement. -``` - -### PHASE 2: Delegate implementation to the implementer subagent - -Delegate to the **implementer** subagent to implement the specified task group(s): - -Provide to the subagent: -- The specific task group(s) from `agent-os/specs/[this-spec]/tasks.md` including the parent task, all sub-tasks, and any sub-bullet points -- The path to this spec's documentation: `agent-os/specs/[this-spec]/spec.md` -- The path to this spec's requirements: `agent-os/specs/[this-spec]/planning/requirements.md` -- The path to this spec's visuals (if any): `agent-os/specs/[this-spec]/planning/visuals` - -Instruct the subagent to: -1. Analyze the provided spec.md, requirements.md, and visuals (if any) -2. Analyze patterns in the codebase according to its built-in workflow -3. Implement the assigned task group according to requirements and standards -4. Update `agent-os/specs/[this-spec]/tasks.md` to mark completed tasks with `- [x]` - -### PHASE 3: Produce the final verification report - -IF ALL task groups in tasks.md are marked complete with `- [x]`, then proceed with this step. Otherwise, return to PHASE 1. - -Assuming all tasks are marked complete, then delegate to the **implementation-verifier** subagent to do its implementation verification and produce its final verification report. - -Provide to the subagent the following: -- The path to this spec: `agent-os/specs/[this-spec]` -Instruct the subagent to do the following: - 1. Run all of its final verifications according to its built-in workflow - 2. Produce the final verification report in `agent-os/specs/[this-spec]/verifications/final-verification.md`. diff --git a/profiles/default/commands/implement-tasks/single-agent/1-determine-tasks.md b/profiles/default/commands/implement-tasks/single-agent/1-determine-tasks.md deleted file mode 100644 index 5a1204d7..00000000 --- a/profiles/default/commands/implement-tasks/single-agent/1-determine-tasks.md +++ /dev/null @@ -1,13 +0,0 @@ -First, check if the user has already provided instructions about which task group(s) to implement. - -**If the user HAS provided instructions:** Proceed to PHASE 2 to delegate implementation of those specified task group(s) to the **implementer** subagent. - -**If the user has NOT provided instructions:** - -Read `agent-os/specs/[this-spec]/tasks.md` to review the available task groups, then output the following message to the user and WAIT for their response: - -``` -Should we proceed with implementation of all task groups in tasks.md? - -If not, then please specify which task(s) to implement. -``` diff --git a/profiles/default/commands/implement-tasks/single-agent/2-implement-tasks.md b/profiles/default/commands/implement-tasks/single-agent/2-implement-tasks.md deleted file mode 100644 index 2c575c3d..00000000 --- a/profiles/default/commands/implement-tasks/single-agent/2-implement-tasks.md +++ /dev/null @@ -1,31 +0,0 @@ -Now that you have the task group(s) to be implemented, proceed with implementation by following these instructions: - -{{workflows/implementation/implement-tasks}} - -## Display confirmation and next step - -Display a summary of what was implemented. - -IF all tasks are now marked as done (with `- [x]`) in tasks.md, display this message to user: - -``` -All tasks have been implemented: `agent-os/specs/[this-spec]/tasks.md`. - -NEXT STEP πŸ‘‰ Run `3-verify-implementation.md` to verify the implementation. -``` - -IF there are still tasks in tasks.md that have yet to be implemented (marked unfinished with `- [ ]`) then display this message to user: - -``` -Would you like to proceed with implementation of the remaining tasks in tasks.md? - -If not, please specify which task group(s) to implement next. -``` - -{{UNLESS standards_as_claude_code_skills}} -## User Standards & Preferences Compliance - -IMPORTANT: Ensure that the tasks list is ALIGNED and DOES NOT CONFLICT with the user's preferences and standards as detailed in the following files: - -{{standards/*}} -{{ENDUNLESS standards_as_claude_code_skills}} diff --git a/profiles/default/commands/implement-tasks/single-agent/3-verify-implementation.md b/profiles/default/commands/implement-tasks/single-agent/3-verify-implementation.md deleted file mode 100644 index e592eaf5..00000000 --- a/profiles/default/commands/implement-tasks/single-agent/3-verify-implementation.md +++ /dev/null @@ -1,19 +0,0 @@ -Now that we've implemented all tasks in tasks.md, we must run final verifications and produce a verification report using the following MULTI-PHASE workflow: - -## Workflow - -### Step 1: Ensure tasks.md has been updated - -{{workflows/implementation/verification/verify-tasks}} - -### Step 2: Update roadmap (if applicable) - -{{workflows/implementation/verification/update-roadmap}} - -### Step 3: Run entire tests suite - -{{workflows/implementation/verification/run-all-tests}} - -### Step 4: Create final verification report - -{{workflows/implementation/verification/create-verification-report}} diff --git a/profiles/default/commands/implement-tasks/single-agent/implement-tasks.md b/profiles/default/commands/implement-tasks/single-agent/implement-tasks.md deleted file mode 100644 index fc96e8d3..00000000 --- a/profiles/default/commands/implement-tasks/single-agent/implement-tasks.md +++ /dev/null @@ -1,15 +0,0 @@ -Now that we have a spec and tasks list ready for implementation, we will proceed with implementation of this spec by following this multi-phase process: - -PHASE 1: Determine which task group(s) from tasks.md should be implemented -PHASE 2: Implement the given task(s) -PHASE 3: After ALL task groups have been implemented, produce the final verification report. - -Carefully read and execute the instructions in the following files IN SEQUENCE, following their numbered file names. Only proceed to the next numbered instruction file once the previous numbered instruction has been executed. - -Instructions to follow in sequence: - -{{PHASE 1: @agent-os/commands/implement-tasks/1-determine-tasks.md}} - -{{PHASE 2: @agent-os/commands/implement-tasks/2-implement-tasks.md}} - -{{PHASE 3: @agent-os/commands/implement-tasks/3-verify-implementation.md}} diff --git a/profiles/default/commands/improve-skills/improve-skills.md b/profiles/default/commands/improve-skills/improve-skills.md deleted file mode 100644 index f4f1a7df..00000000 --- a/profiles/default/commands/improve-skills/improve-skills.md +++ /dev/null @@ -1,74 +0,0 @@ -I want you to help me improve the files that make up my Claude Code Skills by rewriting their descriptions so that they can be more readily discovered and used by Claude Code when it works on coding tasks. - -You can refer to the Claude Code documentation on the Skills feature here: https://docs.claude.com/en/docs/claude-code/skills - -All of the Skills in our project are located in `.claude/skills/`. Each Skill has its own folder and inside each Skill folder is a file called `SKILL.md`. - -LOOP through each `SKILL.md` file and FOR EACH use the following process to revise its content and improve it: - -## Claude Code Skill Improvement Process - -### Step 1: Confirm which skills to improve - -First, ask the user to confirm whether they want ALL of their Claude Code skills to be improved, only select Skills. Assume the answer will be "all" but ask the user to confirm by displaying the following message, then WAIT for the user's response before proceeding to Step 2: - -``` -Before I proceed with improving your Claude Code Skills, can you confirm that you want me to revise and improve ALL Skills in your .claude/skills/ folder? - -If not, then please specify which Skills I should include or exclude. -``` - -### Step 2: Analyze what this Skill does - -Analyze and read the skill file to understand what it is, what it should be used for, and when it should be used. The specific best practices are described and linked within it. Look to these places to read and understand each skill: - -- The Skill's name and file name. -- The Skill.md contains a link that points to `agent_os/standards/...` β€” Follow that link and read its contents. - -### Step 3: Rewrite the Skill description - -The most important element of a skill.md file that impacts its discoverability and trigger-ability by Claude Code is the content we write in the `description` in the skill.md frontmatter. - -Rewrite this description using the following guidelines: - -- The first sentence should clearly describe what this skill is. For example: "Write Tailwind CSS code and structure front-end UIs using Tailwind CSS utility classes." -- The second sentence and subsequent sentences should clearly and directly describe multiple examples where and when this skill should be used. -- The use case examples can include "When writing or editing [file types]" where [file types] can be a list of file extensions or types of files or components commonly found in software projects. -- The use case examples can also include situations or areas or tools where using this skill should come into play. -- The description text can be long. There is no maximum character or word limit. -- Focus on adding examples where the skill SHOULD be used. Do not include instructions on when NOT to use a skill (our goal is for the Skill to be readily found and used frequently). - -### Step 4: Insert a section for 'When to use this skill' - -At the top of the content of skill.md, below the frontmatter, insert an H2 heading, "When to use this skill" followed by a list of use case examples. - -The use case examples can repeat the same one(s) listed in the description and/or expand on them. - -Example: -```markdown -## When to use this skill: - -- [Descriptive example A] -- [Descriptive example B] -- [Descriptive example C] -... -``` - -### Step 5: Advise the user on improving their skills further - -After revising ALL Skill.md files located in the project's `.claude/skills/` folder, display the following message to the user to advise them on how to improve their Claude Code Skills further: - -``` -All Claude Code Skills have been analyzed and revised! - -RECOMMENDATION πŸ‘‰ Review and revise them further using these tips: - -- Make Skills as descriptive as possible -- Use their 'description' frontmatter to tell Claude Code when it should proactively use this skill. -- Include all relevant instructions, details and directives within the content of the Skill. -- You can link to other files (like your Agent OS standards files) using markdown links. -- You can consolidate multiple similar skills into single skills where it makes sense for Claude to find and use them together. - -For more best practices, refer to the official Claude Code documentation on Skills: -https://docs.claude.com/en/docs/claude-code/skills -``` diff --git a/profiles/default/commands/orchestrate-tasks/orchestrate-tasks.md b/profiles/default/commands/orchestrate-tasks/orchestrate-tasks.md deleted file mode 100644 index 9f1e51a3..00000000 --- a/profiles/default/commands/orchestrate-tasks/orchestrate-tasks.md +++ /dev/null @@ -1,237 +0,0 @@ -# Process for Orchestrating a Spec's Implementation - -Now that we have a spec and tasks list ready for implementation, we will proceed with orchestrating implementation of each task group by a dedicated agent using the following MULTI-PHASE process. - -Follow each of these phases and their individual workflows IN SEQUENCE: - -## Multi-Phase Process - -### FIRST: Get tasks.md for this spec - -IF you already know which spec we're working on and IF that spec folder has a `tasks.md` file, then use that and skip to the NEXT phase. - -IF you don't already know which spec we're working on and IF that spec folder doesn't yet have a `tasks.md` THEN output the following request to the user: - -``` -Please point me to a spec's `tasks.md` that you want to orchestrate implementation for. - -If you don't have one yet, then run any of these commands first: -/shape-spec -/write-spec -/create-tasks -``` - -### NEXT: Create orchestration.yml to serve as a roadmap for orchestration of task groups - -In this spec's folder, create this file: `agent-os/specs/[this-spec]/orchestration.yml`. - -Populate this file with with the names of each task group found in this spec's `tasks.md` and use this EXACT structure for the content of `orchestration.yml`: - -```yaml -task_groups: - - name: [task-group-name] - - name: [task-group-name] - - name: [task-group-name] - # Repeat for each task group found in tasks.md -``` - -{{IF use_claude_code_subagents}} -### NEXT: Ask user to assign subagents to each task group - -Next we must determine which subagents should be assigned to which task groups. Ask the user to provide this info using the following request to user and WAIT for user's response: - -``` -Please specify the name of each subagent to be assigned to each task group: - -1. [task-group-name] -2. [task-group-name] -3. [task-group-name] -[repeat for each task-group you've added to orchestration.yml] - -Simply respond with the subagent names and corresponding task group number and I'll update orchestration.yml accordingly. -``` - -Using the user's responses, update `orchestration.yml` to specify those subagent names. `orchestration.yml` should end up looking like this: - -```yaml -task_groups: - - name: [task-group-name] - claude_code_subagent: [subagent-name] - - name: [task-group-name] - claude_code_subagent: [subagent-name] - - name: [task-group-name] - claude_code_subagent: [subagent-name] - # Repeat for each task group found in tasks.md -``` - -For example, after this step, the `orchestration.yml` file might look like this (exact names will vary): - -```yaml -task_groups: - - name: authentication-system - claude_code_subagent: backend-specialist - - name: user-dashboard - claude_code_subagent: frontend-specialist - - name: api-endpoints - claude_code_subagent: backend-specialist -``` -{{ENDIF use_claude_code_subagents}} - -{{UNLESS standards_as_claude_code_skills}} -### NEXT: Ask user to assign standards to each task group - -Next we must determine which standards should guide the implementation of each task group. Ask the user to provide this info using the following request to user and WAIT for user's response: - -``` -Please specify the standard(s) that should be used to guide the implementation of each task group: - -1. [task-group-name] -2. [task-group-name] -3. [task-group-name] -[repeat for each task-group you've added to orchestration.yml] - -For each task group number, you can specify any combination of the following: - -"all" to include all of your standards -"global/*" to include all of the files inside of standards/global -"frontend/css.md" to include the css.md standard file -"none" to include no standards for this task group. -``` - -Using the user's responses, update `orchestration.yml` to specify those standards for each task group. `orchestration.yml` should end up having AT LEAST the following information added to it: - -```yaml -task_groups: - - name: [task-group-name] - standards: - - [users' 1st response for this task group] - - [users' 2nd response for this task group] - - [users' 3rd response for this task group] - # Repeat for all standards that the user specified for this task group - - name: [task-group-name] - standards: - - [users' 1st response for this task group] - - [users' 2nd response for this task group] - # Repeat for all standards that the user specified for this task group - # Repeat for each task group found in tasks.md -``` - -For example, after this step, the `orchestration.yml` file might look like this (exact names will vary): - -```yaml -task_groups: - - name: authentication-system - standards: - - all - - name: user-dashboard - standards: - - global/* - - frontend/components.md - - frontend/css.md - - name: task-group-with-no-standards - - name: api-endpoints - standards: - - backend/* - - global/error-handling.md -``` - -Note: If the `use_claude_code_subagents` flag is enabled, the final `orchestration.yml` would include BOTH `claude_code_subagent` assignments AND `standards` for each task group. -{{ENDUNLESS standards_as_claude_code_skills}} - -{{IF use_claude_code_subagents}} -### NEXT: Delegate task groups implementations to assigned subagents - -Loop through each task group in `agent-os/specs/[this-spec]/tasks.md` and delegate its implementation to the assigned subagent specified in `orchestration.yml`. - -For each delegation, provide the subagent with: -- The task group (including the parent task and all sub-tasks) -- The spec file: `agent-os/specs/[this-spec]/spec.md` -- Instruct subagent to: - - Perform their implementation - - Check off the task and sub-task(s) in `agent-os/specs/[this-spec]/tasks.md` -{{UNLESS standards_as_claude_code_skills}} - -In addition to the above items, also instruct the subagent to closely adhere to the user's standards & preferences as specified in the following files. To build the list of file references to give to the subagent, follow these instructions: - -{{workflows/implementation/compile-implementation-standards}} - -Provide all of the above to the subagent when delegating tasks for it to implement. -{{ENDUNLESS standards_as_claude_code_skills}} -{{ENDIF use_claude_code_subagents}} - -{{UNLESS use_claude_code_subagents}} -### NEXT: Generate prompts - -Now we must generate an ordered series of prompt texts, which will be used to direct the implementation of each task group listed in `orchestration.yml`. - -Follow these steps to generate this spec's ordered series of prompts texts, each in its own .md file located in `agent-os/specs/[this-spec]/implementation/prompts/`. - -LOOP through EACH task group in `agent-os/specs/[this-spec]/tasks.md` and for each, use the following workflow to generate a markdown file with prompt text for each task group: - -#### Step 1. Create the prompt markdown file - -Create the prompt markdown file using this naming convention: -`agent-os/specs/[this-spec]/implementation/prompts/[task-group-number]-[task-group-title].md`. - -For example, if the 3rd task group in tasks.md is named "Comment System" then create `3-comment-system.md`. - -#### Step 2. Populate the prompt file - -Populate the prompt markdown file using the following Prompt file content template. - -##### Bracket content replacements - -In the content template below, replace "[spec-title]" and "[this-spec]" with the current spec's title, and "[task-group-number]" with the current task group's number. - -{{UNLESS standards_as_claude_code_skills}} -To replace "[orchestrated-standards]", use the following workflow: - -{{workflows/implementation/compile-implementation-standards}} -{{ENDUNLESS standards_as_claude_code_skills}} - -#### Prompt file content template: - -```markdown -We're continuing our implementation of [spec-title] by implementing task group number [task-group-number]: - -## Implement this task and its sub-tasks: - -[paste entire task group including parent task, all of its' sub-tasks, and sub-bullet points] - -## Understand the context - -Read @agent-os/specs/[this-spec]/spec.md to understand the context for this spec and where the current task fits into it. - -Also read these further context and reference: -- @agent-os/specs/[this-spec/]/planning/requirements.md -- @agent-os/specs/[this-spec/]/planning/visuals - -## Perform the implementation - -{{workflows/implementation/implement-tasks}} - -{{UNLESS standards_as_claude_code_skills}} -## User Standards & Preferences Compliance - -IMPORTANT: Ensure that your implementation work is ALIGNED and DOES NOT CONFLICT with the user's preferences and standards as detailed in the following files: - -[orchestrated-standards] -{{ENDUNLESS standards_as_claude_code_skills}} -``` - -### Step 3: Output the list of created prompt files - -Output to user the following: - -``` -Ready to begin implementation of [spec-title]! - -Use the following list of prompts to direct the implementation of each task group: - -[list prompt files in order] - -Input those prompts into this chat one-by-one or queue them to run in order. - -Progress will be tracked in `agent-os/specs/[this-spec]/tasks.md` -``` -{{ENDUNLESS use_claude_code_subagents}} diff --git a/profiles/default/commands/plan-product/multi-agent/plan-product.md b/profiles/default/commands/plan-product/multi-agent/plan-product.md deleted file mode 100644 index fc579cf8..00000000 --- a/profiles/default/commands/plan-product/multi-agent/plan-product.md +++ /dev/null @@ -1,36 +0,0 @@ -## Product Planning Process - -You are helping to plan and document the mission, roadmap and tech stack for the current product. This will include: - -- **Gathering Information**: The user's product vision, user personas, problems and key features -- **Mission Document**: Take what you've gathered and create a concise mission document -- **Roadmap**: Create a phased development plan with prioritized features -- **Tech stack**: Establish the technical stack used for all aspects of this product's codebase - -This process will create these files in `agent-os/product/` directory. - -### PHASE 1: Gather Product Requirements - -Use the **product-planner** subagent to create comprehensive product documentation. - -IF the user has provided any details in regards to the product idea, its purpose, features list, target users and any other details then provide those to the **product-planner** subagent. - -The product-planner will: -- Confirm (or gather) product idea, features, target users, confirm the tech stack and gather other details -- Create `agent-os/product/mission.md` with product vision and strategy -- Create `agent-os/product/roadmap.md` with phased development plan -- Create `agent-os/product/tech-stack.md` documenting all of this product's tech stack choices - -### PHASE 2: Inform the user - -After all steps are complete, output the following to inform the user: - -``` -Your product planning is all set! - -βœ… Product mission: `agent-os/product/mission.md` -βœ… Product roadmap: `agent-os/product/roadmap.md` -βœ… Product tech stack: `agent-os/product/tech-stack.md` - -NEXT STEP πŸ‘‰ Run `/shape-spec` or `/write-spec` to start work on a feature! -``` diff --git a/profiles/default/commands/plan-product/single-agent/1-product-concept.md b/profiles/default/commands/plan-product/single-agent/1-product-concept.md deleted file mode 100644 index a679f49d..00000000 --- a/profiles/default/commands/plan-product/single-agent/1-product-concept.md +++ /dev/null @@ -1,27 +0,0 @@ -This begins a multi-step process for planning and documenting the mission and roadmap for the current product. - -The FIRST STEP is to confirm the product details by following these instructions: - -{{workflows/planning/gather-product-info}} - -Then WAIT for me to give you specific instructions on how to use the information you've gathered to create the mission and roadmap. - -{{UNLESS compiled_single_command}} -## Display confirmation and next step - -Once you've gathered all of the necessary information, output the following message: - -``` -I have all the info I need to help you plan this product. - -NEXT STEP πŸ‘‰ Run the command, `2-create-mission.md` -``` -{{ENDUNLESS compiled_single_command}} - -{{UNLESS standards_as_claude_code_skills}} -## User Standards & Preferences Compliance - -When planning the product's tech stack, mission statement and roadmap, use the user's standards and preferences for context and baseline assumptions, as documented in these files: - -{{standards/global/*}} -{{ENDUNLESS standards_as_claude_code_skills}} diff --git a/profiles/default/commands/plan-product/single-agent/2-create-mission.md b/profiles/default/commands/plan-product/single-agent/2-create-mission.md deleted file mode 100644 index 4688ab63..00000000 --- a/profiles/default/commands/plan-product/single-agent/2-create-mission.md +++ /dev/null @@ -1,25 +0,0 @@ -Now that you've gathered information about this product, use that info to create the mission document in `agent-os/product/mission.md` by following these instructions: - -{{workflows/planning/create-product-mission}} - -{{UNLESS compiled_single_command}} -## Display confirmation and next step - -Once you've created mission.md, output the following message: - -``` -βœ… I have documented the product mission at `agent-os/product/mission.md`. - -Review it to ensure it matches your vision and strategic goals for this product. - -NEXT STEP πŸ‘‰ Run the command, `3-create-roadmap.md` -``` -{{ENDUNLESS compiled_single_command}} - -{{UNLESS standards_as_claude_code_skills}} -## User Standards & Preferences Compliance - -IMPORTANT: Ensure the product mission is ALIGNED and DOES NOT CONFLICT with the user's preferences and standards as detailed in the following files: - -{{standards/global/*}} -{{ENDUNLESS standards_as_claude_code_skills}} diff --git a/profiles/default/commands/plan-product/single-agent/3-create-roadmap.md b/profiles/default/commands/plan-product/single-agent/3-create-roadmap.md deleted file mode 100644 index 61088a6d..00000000 --- a/profiles/default/commands/plan-product/single-agent/3-create-roadmap.md +++ /dev/null @@ -1,25 +0,0 @@ -Now that you've created this product's mission.md, use that to guide your creation of the roadmap in `agent-os/product/roadmap.md` by following these instructions: - -{{workflows/planning/create-product-roadmap}} - -{{UNLESS compiled_single_command}} -## Display confirmation and next step - -Once you've created roadmap.md, output the following message: - -``` -βœ… I have documented the product roadmap at `agent-os/product/roadmap.md`. - -Review it to ensure it aligns with how you see this product roadmap going forward. - -NEXT STEP πŸ‘‰ Run the command, `4-create-tech-stack.md` -``` -{{ENDUNLESS compiled_single_command}} - -{{UNLESS standards_as_claude_code_skills}} -## User Standards & Preferences Compliance - -IMPORTANT: Ensure the product roadmap is ALIGNED and DOES NOT CONFLICT with the user's preferences and standards as detailed in the following files: - -{{standards/global/*}} -{{ENDUNLESS standards_as_claude_code_skills}} diff --git a/profiles/default/commands/plan-product/single-agent/4-create-tech-stack.md b/profiles/default/commands/plan-product/single-agent/4-create-tech-stack.md deleted file mode 100644 index b75720cd..00000000 --- a/profiles/default/commands/plan-product/single-agent/4-create-tech-stack.md +++ /dev/null @@ -1,23 +0,0 @@ -The final part of our product planning process is to document this product's tech stack in `agent-os/product/tech-stack.md`. Follow these instructions to do so: - -{{workflows/planning/create-product-tech-stack}} - -## Display confirmation and next step - -Once you've created tech-stack.md, output the following message: - -``` -βœ… I have documented the product's tech stack at `agent-os/product/tech-stack.md`. - -Review it to ensure all of the tech stack details are correct for this product. - -You're ready to start planning a feature spec! You can do so by running `shape-spec.md` or `write-spec.md`. -``` - -{{UNLESS standards_as_claude_code_skills}} -## User Standards & Preferences Compliance - -The user may provide information regarding their tech stack, which should take precidence when documenting the product's tech stack. To fill in any gaps, find the user's usual tech stack information as documented in any of these files: - -{{standards/global/*}} -{{ENDUNLESS standards_as_claude_code_skills}} diff --git a/profiles/default/commands/plan-product/single-agent/plan-product.md b/profiles/default/commands/plan-product/single-agent/plan-product.md deleted file mode 100644 index 6d3525e4..00000000 --- a/profiles/default/commands/plan-product/single-agent/plan-product.md +++ /dev/null @@ -1,18 +0,0 @@ -You are helping to plan and document the mission, roadmap and tech stack for the current product. This will include: - -- **Gathering Information**: The user's product vision, user personas, problems and key features -- **Mission Document**: Take what you've gathered and create a concise mission document -- **Roadmap**: Create a phased development plan with prioritized features -- **Tech stack**: Establish the technical stack used for all aspects of this product's codebase - -Carefully read and execute the instructions in the following files IN SEQUENCE, following their numbered file names. Only proceed to the next numbered instruction file once the previous numbered instruction has been executed. - -Instructions to follow in sequence: - -{{PHASE 1: @agent-os/commands/plan-product/1-product-concept.md}} - -{{PHASE 2: @agent-os/commands/plan-product/2-create-mission.md}} - -{{PHASE 3: @agent-os/commands/plan-product/3-create-roadmap.md}} - -{{PHASE 4: @agent-os/commands/plan-product/4-create-tech-stack.md}} diff --git a/profiles/default/commands/shape-spec/multi-agent/shape-spec.md b/profiles/default/commands/shape-spec/multi-agent/shape-spec.md deleted file mode 100644 index f69dbe40..00000000 --- a/profiles/default/commands/shape-spec/multi-agent/shape-spec.md +++ /dev/null @@ -1,52 +0,0 @@ -# Spec Shaping Process - -You are helping me shape and plan the scope for a new feature. The following process is aimed at documenting our key decisions regarding scope, design and architecture approach. We will use our findings from this process later when we write the formal spec document (but we are NOT writing the formal spec yet). - -This process will follow 3 main phases, each with their own workflow steps: - -Process overview (details to follow) - -PHASE 1. Initilize spec -PHASE 2. Research requirements for this spec -PHASE 3. Inform the user that the spec has been initialized - -Follow each of these phases and their individual workflows IN SEQUENCE: - -## Multi-Phase Process: - -### PHASE 1: Initialize Spec - -Use the **spec-initializer** subagent to initialize a new spec. - -IF the user has provided a description, provide that to the spec-initializer. - -The spec-initializer will provide the path to the dated spec folder (YYYY-MM-DD-spec-name) they've created. - -### PHASE 2: Research Requirements - -After spec-initializer completes, immediately use the **spec-shaper** subagent: - -Provide the spec-shaper with: -- The spec folder path from spec-initializer - -The spec-shaper will give you several separate responses that you MUST show to the user. These include: -1. Numbered clarifying questions along with a request for visual assets (show these to user, wait for user's response) -2. Follow-up questions if needed (based on user's answers and provided visuals) - -**IMPORTANT**: -- Display these questions to the user and wait for their response -- The spec-shaper may ask you to relay follow-up questions that you must present to user - -### PHASE 3: Inform the user - -After all steps complete, inform the user: - -``` -Spec shaping is complete! - -βœ… Spec folder created: `[spec-path]` -βœ… Requirements gathered -βœ… Visual assets: [Found X files / No files provided] - -NEXT STEP πŸ‘‰ Run `/write-spec` to generate the detailed specification document. -``` diff --git a/profiles/default/commands/shape-spec/single-agent/1-initialize-spec.md b/profiles/default/commands/shape-spec/single-agent/1-initialize-spec.md deleted file mode 100644 index 48df2840..00000000 --- a/profiles/default/commands/shape-spec/single-agent/1-initialize-spec.md +++ /dev/null @@ -1,15 +0,0 @@ -The FIRST STEP is to initialize the spec by following these instructions: - -{{workflows/specification/initialize-spec}} - -{{UNLESS compiled_single_command}} -## Display confirmation and next step - -Once you've initialized the spec folder, output the following message (replace `[this-spec]` with the folder name for this spec) - -``` -βœ… I have initialized the spec folder at `agent-os/specs/[this-spec]`. - -NEXT STEP πŸ‘‰ Run the command, 2-research-spec.md -``` -{{ENDUNLESS compiled_single_command}} diff --git a/profiles/default/commands/shape-spec/single-agent/2-shape-spec.md b/profiles/default/commands/shape-spec/single-agent/2-shape-spec.md deleted file mode 100644 index 391013ba..00000000 --- a/profiles/default/commands/shape-spec/single-agent/2-shape-spec.md +++ /dev/null @@ -1,35 +0,0 @@ -Now that you've initialized the folder for this new spec, proceed with the research phase. - -Follow these instructions for researching this spec's requirements: - -{{workflows/specification/research-spec}} - -## Display confirmation and next step - -Once you've completed your research and documented it, output the following message: - -``` -βœ… I have documented this spec's research and requirements in `agent-os/specs/[this-spec]/planning`. - -Next step: Run the command, `1-create-spec.md`. -``` - -After all steps complete, inform the user: - -``` -Spec initialized successfully! - -βœ… Spec folder created: `[spec-path]` -βœ… Requirements gathered -βœ… Visual assets: [Found X files / No files provided] - -πŸ‘‰ Run `/write-spec` to create the spec.md document. -``` - -{{UNLESS standards_as_claude_code_skills}} -## User Standards & Preferences Compliance - -IMPORTANT: Ensure that your research questions and insights are ALIGNED and DOES NOT CONFLICT with the user's preferences and standards as detailed in the following files: - -{{standards/global/*}} -{{ENDUNLESS standards_as_claude_code_skills}} diff --git a/profiles/default/commands/shape-spec/single-agent/shape-spec.md b/profiles/default/commands/shape-spec/single-agent/shape-spec.md deleted file mode 100644 index cab2088d..00000000 --- a/profiles/default/commands/shape-spec/single-agent/shape-spec.md +++ /dev/null @@ -1,9 +0,0 @@ -You are helping me shape and plan the scope for a new feature. The following MULTI-PHASE process is aimed at documenting our key decisions regarding scope, design and architecture approach. - -Carefully read and execute the instructions in the following files IN SEQUENCE, following their numbered file names. Only proceed to the next numbered instruction file once the previous numbered instruction has been executed. - -Instructions to follow in sequence: - -{{PHASE 1: @agent-os/commands/shape-spec/1-initialize-spec.md}} - -{{PHASE 2: @agent-os/commands/shape-spec/2-shape-spec.md}} diff --git a/profiles/default/commands/write-spec/multi-agent/write-spec.md b/profiles/default/commands/write-spec/multi-agent/write-spec.md deleted file mode 100644 index 49c2cc30..00000000 --- a/profiles/default/commands/write-spec/multi-agent/write-spec.md +++ /dev/null @@ -1,22 +0,0 @@ -# Spec Writing Process - -You are creating a comprehensive specification for a new feature. - -Use the **spec-writer** subagent to create the specification document for this spec: - -Provide the spec-writer with: -- The spec folder path (find the current one or the most recent in `agent-os/specs/*/`) -- The requirements from `planning/requirements.md` -- Any visual assets in `planning/visuals/` - -The spec-writer will create `spec.md` inside the spec folder. - -Once the spec-writer has created `spec.md` output the following to inform the user: - -``` -Your spec.md is ready! - -βœ… Spec document created: `[spec-path]` - -NEXT STEP πŸ‘‰ Run `/create-tasks` to generate your tasks list for this spec. -``` diff --git a/profiles/default/commands/write-spec/single-agent/write-spec.md b/profiles/default/commands/write-spec/single-agent/write-spec.md deleted file mode 100644 index c9f6d3fa..00000000 --- a/profiles/default/commands/write-spec/single-agent/write-spec.md +++ /dev/null @@ -1,23 +0,0 @@ -Now that we've initiated and planned the details for a new spec, we will now proceed with drafting the specification document, following these instructions: - -{{workflows/specification/write-spec}} - -## Display confirmation and next step - -Display the following message to the user: - -``` -The spec has been created at `agent-os/specs/[this-spec]/spec.md`. - -Review it closely to ensure everything aligns with your vision and requirements. - -Next step: Run the command, 2-create-tasks-list.md -``` - -{{UNLESS standards_as_claude_code_skills}} -## User Standards & Preferences Compliance - -IMPORTANT: Ensure that the specification document's content is ALIGNED and DOES NOT CONFLICT with the user's preferences and standards as detailed in the following files: - -{{standards/*}} -{{ENDUNLESS standards_as_claude_code_skills}} diff --git a/profiles/default/global/tech-stack.md b/profiles/default/global/tech-stack.md new file mode 100644 index 00000000..6ed5dbfb --- /dev/null +++ b/profiles/default/global/tech-stack.md @@ -0,0 +1,18 @@ +# Tech Stack + +## Frontend + +- React 18 with TypeScript +- Tailwind CSS v4 for styling +- Vite for build tooling + +## Backend + +- Node.js with Express +- TypeScript + +## Database + +- PostgreSQL + +## Other diff --git a/profiles/default/standards/backend/api.md b/profiles/default/standards/backend/api.md deleted file mode 100644 index d8bd5c29..00000000 --- a/profiles/default/standards/backend/api.md +++ /dev/null @@ -1,10 +0,0 @@ -## API endpoint standards and conventions - -- **RESTful Design**: Follow REST principles with clear resource-based URLs and appropriate HTTP methods (GET, POST, PUT, PATCH, DELETE) -- **Consistent Naming**: Use consistent, lowercase, hyphenated or underscored naming conventions for endpoints across the API -- **Versioning**: Implement API versioning strategy (URL path or headers) to manage breaking changes without disrupting existing clients -- **Plural Nouns**: Use plural nouns for resource endpoints (e.g., `/users`, `/products`) for consistency -- **Nested Resources**: Limit nesting depth to 2-3 levels maximum to keep URLs readable and maintainable -- **Query Parameters**: Use query parameters for filtering, sorting, pagination, and search rather than creating separate endpoints -- **HTTP Status Codes**: Return appropriate, consistent HTTP status codes that accurately reflect the response (200, 201, 400, 404, 500, etc.) -- **Rate Limiting Headers**: Include rate limit information in response headers to help clients manage their usage diff --git a/profiles/default/standards/backend/migrations.md b/profiles/default/standards/backend/migrations.md deleted file mode 100644 index 494a74c5..00000000 --- a/profiles/default/standards/backend/migrations.md +++ /dev/null @@ -1,9 +0,0 @@ -## Database migration best practices - -- **Reversible Migrations**: Always implement rollback/down methods to enable safe migration reversals -- **Small, Focused Changes**: Keep each migration focused on a single logical change for clarity and easier troubleshooting -- **Zero-Downtime Deployments**: Consider deployment order and backwards compatibility for high-availability systems -- **Separate Schema and Data**: Keep schema changes separate from data migrations for better rollback safety -- **Index Management**: Create indexes on large tables carefully, using concurrent options when available to avoid locks -- **Naming Conventions**: Use clear, descriptive names that indicate what the migration does -- **Version Control**: Always commit migrations to version control and never modify existing migrations after deployment diff --git a/profiles/default/standards/backend/models.md b/profiles/default/standards/backend/models.md deleted file mode 100644 index 1a1e46d8..00000000 --- a/profiles/default/standards/backend/models.md +++ /dev/null @@ -1,10 +0,0 @@ -## Database model best practices - -- **Clear Naming**: Use singular names for models and plural for tables following your framework's conventions -- **Timestamps**: Include created and updated timestamps on all tables for auditing and debugging -- **Data Integrity**: Use database constraints (NOT NULL, UNIQUE, foreign keys) to enforce data rules at the database level -- **Appropriate Data Types**: Choose data types that match the data's purpose and size requirements -- **Indexes on Foreign Keys**: Index foreign key columns and other frequently queried fields for performance -- **Validation at Multiple Layers**: Implement validation at both model and database levels for defense in depth -- **Relationship Clarity**: Define relationships clearly with appropriate cascade behaviors and naming conventions -- **Avoid Over-Normalization**: Balance normalization with practical query performance needs diff --git a/profiles/default/standards/backend/queries.md b/profiles/default/standards/backend/queries.md deleted file mode 100644 index 3edeb590..00000000 --- a/profiles/default/standards/backend/queries.md +++ /dev/null @@ -1,9 +0,0 @@ -## Database query best practices - -- **Prevent SQL Injection**: Always use parameterized queries or ORM methods; never interpolate user input into SQL strings -- **Avoid N+1 Queries**: Use eager loading or joins to fetch related data in a single query instead of multiple queries -- **Select Only Needed Data**: Request only the columns you need rather than using SELECT * for better performance -- **Index Strategic Columns**: Index columns used in WHERE, JOIN, and ORDER BY clauses for query optimization -- **Use Transactions for Related Changes**: Wrap related database operations in transactions to maintain data consistency -- **Set Query Timeouts**: Implement timeouts to prevent runaway queries from impacting system performance -- **Cache Expensive Queries**: Cache results of complex or frequently-run queries when appropriate diff --git a/profiles/default/standards/frontend/accessibility.md b/profiles/default/standards/frontend/accessibility.md deleted file mode 100644 index 4dc628ce..00000000 --- a/profiles/default/standards/frontend/accessibility.md +++ /dev/null @@ -1,10 +0,0 @@ -## UI accessibility best practices - -- **Semantic HTML**: Use appropriate HTML elements (nav, main, button, etc.) that convey meaning to assistive technologies -- **Keyboard Navigation**: Ensure all interactive elements are accessible via keyboard with visible focus indicators -- **Color Contrast**: Maintain sufficient contrast ratios (4.5:1 for normal text) and don't rely solely on color to convey information -- **Alternative Text**: Provide descriptive alt text for images and meaningful labels for all form inputs -- **Screen Reader Testing**: Test and verify that all views are accessible on screen reading devices. -- **ARIA When Needed**: Use ARIA attributes to enhance complex components when semantic HTML isn't sufficient -- **Logical Heading Structure**: Use heading levels (h1-h6) in proper order to create a clear document outline -- **Focus Management**: Manage focus appropriately in dynamic content, modals, and single-page applications diff --git a/profiles/default/standards/frontend/components.md b/profiles/default/standards/frontend/components.md deleted file mode 100644 index a851b2fc..00000000 --- a/profiles/default/standards/frontend/components.md +++ /dev/null @@ -1,11 +0,0 @@ -## UI component best practices - -- **Single Responsibility**: Each component should have one clear purpose and do it well -- **Reusability**: Design components to be reused across different contexts with configurable props -- **Composability**: Build complex UIs by combining smaller, simpler components rather than monolithic structures -- **Clear Interface**: Define explicit, well-documented props with sensible defaults for ease of use -- **Encapsulation**: Keep internal implementation details private and expose only necessary APIs -- **Consistent Naming**: Use clear, descriptive names that indicate the component's purpose and follow team conventions -- **State Management**: Keep state as local as possible; lift it up only when needed by multiple components -- **Minimal Props**: Keep the number of props manageable; if a component needs many props, consider composition or splitting it -- **Documentation**: Document component usage, props, and provide examples for easier adoption by team members diff --git a/profiles/default/standards/frontend/css.md b/profiles/default/standards/frontend/css.md deleted file mode 100644 index b60d2279..00000000 --- a/profiles/default/standards/frontend/css.md +++ /dev/null @@ -1,7 +0,0 @@ -## CSS best practices - -- **Consistent Methodology**: Apply and stick to the project's consistent CSS methodology (Tailwind, BEM, utility classes, CSS modules, etc.) across the entire project -- **Avoid Overriding Framework Styles**: Work with your framework's patterns rather than fighting against them with excessive overrides -- **Maintain Design System**: Establish and document design tokens (colors, spacing, typography) for consistency -- **Minimize Custom CSS**: Leverage framework utilities and components to reduce custom CSS maintenance burden -- **Performance Considerations**: Optimize for production with CSS purging/tree-shaking to remove unused styles diff --git a/profiles/default/standards/frontend/responsive.md b/profiles/default/standards/frontend/responsive.md deleted file mode 100644 index 1b8fc1ad..00000000 --- a/profiles/default/standards/frontend/responsive.md +++ /dev/null @@ -1,11 +0,0 @@ -## Responsive design best practices - -- **Mobile-First Development**: Start with mobile layout and progressively enhance for larger screens -- **Standard Breakpoints**: Consistently use standard breakpoints across the application (e.g., mobile, tablet, desktop) -- **Fluid Layouts**: Use percentage-based widths and flexible containers that adapt to screen size -- **Relative Units**: Prefer rem/em units over fixed pixels for better scalability and accessibility -- **Test Across Devices**: Test and verify UI changes across multiple screen sizes from mobile to tablet to desktop screen sizes and ensure a balanced, user-friendly viewing and reading experience on all -- **Touch-Friendly Design**: Ensure tap targets are appropriately sized (minimum 44x44px) for mobile users -- **Performance on Mobile**: Optimize images and assets for mobile network conditions and smaller screens -- **Readable Typography**: Maintain readable font sizes across all breakpoints without requiring zoom -- **Content Priority**: Show the most important content first on smaller screens through thoughtful layout decisions diff --git a/profiles/default/standards/global/coding-style.md b/profiles/default/standards/global/coding-style.md deleted file mode 100644 index 493b2945..00000000 --- a/profiles/default/standards/global/coding-style.md +++ /dev/null @@ -1,10 +0,0 @@ -## Coding style best practices - -- **Consistent Naming Conventions**: Establish and follow naming conventions for variables, functions, classes, and files across the codebase -- **Automated Formatting**: Maintain consistent code style (indenting, line breaks, etc.) -- **Meaningful Names**: Choose descriptive names that reveal intent; avoid abbreviations and single-letter variables except in narrow contexts -- **Small, Focused Functions**: Keep functions small and focused on a single task for better readability and testability -- **Consistent Indentation**: Use consistent indentation (spaces or tabs) and configure your editor/linter to enforce it -- **Remove Dead Code**: Delete unused code, commented-out blocks, and imports rather than leaving them as clutter -- **Backward compatibility only when required:** Unless specifically instructed otherwise, assume you do not need to write additional code logic to handle backward compatibility. -- **DRY Principle**: Avoid duplication by extracting common logic into reusable functions or modules diff --git a/profiles/default/standards/global/commenting.md b/profiles/default/standards/global/commenting.md deleted file mode 100644 index 021745e3..00000000 --- a/profiles/default/standards/global/commenting.md +++ /dev/null @@ -1,5 +0,0 @@ -## Code commenting best practices - -- **Self-Documenting Code**: Write code that explains itself through clear structure and naming -- **Minimal, helpful comments**: Add concise, minimal comments to explain large sections of code logic. -- **Don't comment changes or fixes**: Do not leave code comments that speak to recent or temporary changes or fixes. Comments should be evergreen informational texts that are relevant far into the future. diff --git a/profiles/default/standards/global/conventions.md b/profiles/default/standards/global/conventions.md deleted file mode 100644 index 5fdd6925..00000000 --- a/profiles/default/standards/global/conventions.md +++ /dev/null @@ -1,11 +0,0 @@ -## General development conventions - -- **Consistent Project Structure**: Organize files and directories in a predictable, logical structure that team members can navigate easily -- **Clear Documentation**: Maintain up-to-date README files with setup instructions, architecture overview, and contribution guidelines -- **Version Control Best Practices**: Use clear commit messages, feature branches, and meaningful pull/merge requests with descriptions -- **Environment Configuration**: Use environment variables for configuration; never commit secrets or API keys to version control -- **Dependency Management**: Keep dependencies up-to-date and minimal; document why major dependencies are used -- **Code Review Process**: Establish a consistent code review process with clear expectations for reviewers and authors -- **Testing Requirements**: Define what level of testing is required before merging (unit tests, integration tests, etc.) -- **Feature Flags**: Use feature flags for incomplete features rather than long-lived feature branches -- **Changelog Maintenance**: Keep a changelog or release notes to track significant changes and improvements diff --git a/profiles/default/standards/global/error-handling.md b/profiles/default/standards/global/error-handling.md deleted file mode 100644 index 4a4ab049..00000000 --- a/profiles/default/standards/global/error-handling.md +++ /dev/null @@ -1,9 +0,0 @@ -## Error handling best practices - -- **User-Friendly Messages**: Provide clear, actionable error messages to users without exposing technical details or security information -- **Fail Fast and Explicitly**: Validate input and check preconditions early; fail with clear error messages rather than allowing invalid state -- **Specific Exception Types**: Use specific exception/error types rather than generic ones to enable targeted handling -- **Centralized Error Handling**: Handle errors at appropriate boundaries (controllers, API layers) rather than scattering try-catch blocks everywhere -- **Graceful Degradation**: Design systems to degrade gracefully when non-critical services fail rather than breaking entirely -- **Retry Strategies**: Implement exponential backoff for transient failures in external service calls -- **Clean Up Resources**: Always clean up resources (file handles, connections) in finally blocks or equivalent mechanisms diff --git a/profiles/default/standards/global/tech-stack.md b/profiles/default/standards/global/tech-stack.md deleted file mode 100644 index adb309b2..00000000 --- a/profiles/default/standards/global/tech-stack.md +++ /dev/null @@ -1,31 +0,0 @@ -## Tech stack - -Define your technical stack below. This serves as a reference for all team members and helps maintain consistency across the project. - -### Framework & Runtime -- **Application Framework:** [e.g., Rails, Django, Next.js, Express] -- **Language/Runtime:** [e.g., Ruby, Python, Node.js, Java] -- **Package Manager:** [e.g., bundler, pip, npm, yarn] - -### Frontend -- **JavaScript Framework:** [e.g., React, Vue, Svelte, Alpine, vanilla JS] -- **CSS Framework:** [e.g., Tailwind CSS, Bootstrap, custom] -- **UI Components:** [e.g., shadcn/ui, Material UI, custom library] - -### Database & Storage -- **Database:** [e.g., PostgreSQL, MySQL, MongoDB] -- **ORM/Query Builder:** [e.g., ActiveRecord, Prisma, Sequelize] -- **Caching:** [e.g., Redis, Memcached] - -### Testing & Quality -- **Test Framework:** [e.g., Jest, RSpec, pytest] -- **Linting/Formatting:** [e.g., ESLint, Prettier, RuboCop] - -### Deployment & Infrastructure -- **Hosting:** [e.g., Heroku, AWS, Vercel, Railway] -- **CI/CD:** [e.g., GitHub Actions, CircleCI] - -### Third-Party Services -- **Authentication:** [e.g., Auth0, Devise, NextAuth] -- **Email:** [e.g., SendGrid, Postmark] -- **Monitoring:** [e.g., Sentry, Datadog] diff --git a/profiles/default/standards/global/validation.md b/profiles/default/standards/global/validation.md deleted file mode 100644 index 4129e3f5..00000000 --- a/profiles/default/standards/global/validation.md +++ /dev/null @@ -1,11 +0,0 @@ -## Validation best practices - -- **Validate on Server Side**: Always validate on the server; never trust client-side validation alone for security or data integrity -- **Client-Side for UX**: Use client-side validation to provide immediate user feedback, but duplicate checks server-side -- **Fail Early**: Validate input as early as possible and reject invalid data before processing -- **Specific Error Messages**: Provide clear, field-specific error messages that help users correct their input -- **Allowlists Over Blocklists**: When possible, define what is allowed rather than trying to block everything that's not -- **Type and Format Validation**: Check data types, formats, ranges, and required fields systematically -- **Sanitize Input**: Sanitize user input to prevent injection attacks (SQL, XSS, command injection) -- **Business Rule Validation**: Validate business rules (e.g., sufficient balance, valid dates) at the appropriate application layer -- **Consistent Validation**: Apply validation consistently across all entry points (web forms, API endpoints, background jobs) diff --git a/profiles/default/standards/testing/test-writing.md b/profiles/default/standards/testing/test-writing.md deleted file mode 100644 index a57de5ed..00000000 --- a/profiles/default/standards/testing/test-writing.md +++ /dev/null @@ -1,9 +0,0 @@ -## Test coverage best practices - -- **Write Minimal Tests During Development**: Do NOT write tests for every change or intermediate step. Focus on completing the feature implementation first, then add strategic tests only at logical completion points -- **Test Only Core User Flows**: Write tests exclusively for critical paths and primary user workflows. Skip writing tests for non-critical utilities and secondary workflows until if/when you're instructed to do so. -- **Defer Edge Case Testing**: Do NOT test edge cases, error states, or validation logic unless they are business-critical. These can be addressed in dedicated testing phases, not during feature development. -- **Test Behavior, Not Implementation**: Focus tests on what the code does, not how it does it, to reduce brittleness -- **Clear Test Names**: Use descriptive names that explain what's being tested and the expected outcome -- **Mock External Dependencies**: Isolate units by mocking databases, APIs, file systems, and other external services -- **Fast Execution**: Keep unit tests fast (milliseconds) so developers run them frequently during development diff --git a/profiles/default/workflows/implementation/compile-implementation-standards.md b/profiles/default/workflows/implementation/compile-implementation-standards.md deleted file mode 100644 index 6bbe12cc..00000000 --- a/profiles/default/workflows/implementation/compile-implementation-standards.md +++ /dev/null @@ -1,28 +0,0 @@ -#### Compile Implementation Standards - -Use the following logic to compile a list of file references to standards that should guide implementation: - -##### Steps to Compile Standards List - -1. Find the current task group in `orchestration.yml` -2. Check the list of `standards` specified for this task group in `orchestration.yml` -3. Compile the list of file references to those standards, one file reference per line, using this logic for determining which files to include: - a. If the value for `standards` is simply `all`, then include every single file, folder, sub-folder and files within sub-folders in your list of files. - b. If the item under standards ends with "*" then it means that all files within this folder or sub-folder should be included. For example, `frontend/*` means include all files and sub-folders and their files located inside of `agent-os/standards/frontend/`. - c. If a file ends in `.md` then it means this is one specific file you must include in your list of files. For example `backend/api.md` means you must include the file located at `agent-os/standards/backend/api.md`. - d. De-duplicate files in your list of file references. - -##### Output Format - -The compiled list of standards should look something like this, where each file reference is on its own line and begins with `@`. The exact list of files will vary: - -``` -@agent-os/standards/global/coding-style.md -@agent-os/standards/global/conventions.md -@agent-os/standards/global/tech-stack.md -@agent-os/standards/backend/api/authentication.md -@agent-os/standards/backend/api/endpoints.md -@agent-os/standards/backend/api/responses.md -@agent-os/standards/frontend/css.md -@agent-os/standards/frontend/responsive.md -``` diff --git a/profiles/default/workflows/implementation/create-tasks-list.md b/profiles/default/workflows/implementation/create-tasks-list.md deleted file mode 100644 index 437bfaa7..00000000 --- a/profiles/default/workflows/implementation/create-tasks-list.md +++ /dev/null @@ -1,199 +0,0 @@ -# Task List Creation - -## Core Responsibilities - -1. **Analyze spec and requirements**: Read and analyze the spec.md and/or requirements.md to inform the tasks list you will create. -2. **Plan task execution order**: Break the requirements into a list of tasks in an order that takes their dependencies into account. -3. **Group tasks by specialization**: Group tasks that require the same skill or stack specialization together (backend, api, ui design, etc.) -4. **Create Tasks list**: Create the markdown tasks list broken into groups with sub-tasks. - -## Workflow - -### Step 1: Analyze Spec & Requirements - -Read each of these files (whichever are available) and analyze them to understand the requirements for this feature implementation: -- `agent-os/specs/[this-spec]/spec.md` -- `agent-os/specs/[this-spec]/planning/requirements.md` - -Use your learnings to inform the tasks list and groupings you will create in the next step. - - -### Step 2: Create Tasks Breakdown - -Generate `agent-os/specs/[current-spec]/tasks.md`. - -**Important**: The exact tasks, task groups, and organization will vary based on the feature's specific requirements. The following is an example format - adapt the content of the tasks list to match what THIS feature actually needs. - -```markdown -# Task Breakdown: [Feature Name] - -## Overview -Total Tasks: [count] - -## Task List - -### Database Layer - -#### Task Group 1: Data Models and Migrations -**Dependencies:** None - -- [ ] 1.0 Complete database layer - - [ ] 1.1 Write 2-8 focused tests for [Model] functionality - - Limit to 2-8 highly focused tests maximum - - Test only critical model behaviors (e.g., primary validation, key association, core method) - - Skip exhaustive coverage of all methods and edge cases - - [ ] 1.2 Create [Model] with validations - - Fields: [list] - - Validations: [list] - - Reuse pattern from: [existing model if applicable] - - [ ] 1.3 Create migration for [table] - - Add indexes for: [fields] - - Foreign keys: [relationships] - - [ ] 1.4 Set up associations - - [Model] has_many [related] - - [Model] belongs_to [parent] - - [ ] 1.5 Ensure database layer tests pass - - Run ONLY the 2-8 tests written in 1.1 - - Verify migrations run successfully - - Do NOT run the entire test suite at this stage - -**Acceptance Criteria:** -- The 2-8 tests written in 1.1 pass -- Models pass validation tests -- Migrations run successfully -- Associations work correctly - -### API Layer - -#### Task Group 2: API Endpoints -**Dependencies:** Task Group 1 - -- [ ] 2.0 Complete API layer - - [ ] 2.1 Write 2-8 focused tests for API endpoints - - Limit to 2-8 highly focused tests maximum - - Test only critical controller actions (e.g., primary CRUD operation, auth check, key error case) - - Skip exhaustive testing of all actions and scenarios - - [ ] 2.2 Create [resource] controller - - Actions: index, show, create, update, destroy - - Follow pattern from: [existing controller] - - [ ] 2.3 Implement authentication/authorization - - Use existing auth pattern - - Add permission checks - - [ ] 2.4 Add API response formatting - - JSON responses - - Error handling - - Status codes - - [ ] 2.5 Ensure API layer tests pass - - Run ONLY the 2-8 tests written in 2.1 - - Verify critical CRUD operations work - - Do NOT run the entire test suite at this stage - -**Acceptance Criteria:** -- The 2-8 tests written in 2.1 pass -- All CRUD operations work -- Proper authorization enforced -- Consistent response format - -### Frontend Components - -#### Task Group 3: UI Design -**Dependencies:** Task Group 2 - -- [ ] 3.0 Complete UI components - - [ ] 3.1 Write 2-8 focused tests for UI components - - Limit to 2-8 highly focused tests maximum - - Test only critical component behaviors (e.g., primary user interaction, key form submission, main rendering case) - - Skip exhaustive testing of all component states and interactions - - [ ] 3.2 Create [Component] component - - Reuse: [existing component] as base - - Props: [list] - - State: [list] - - [ ] 3.3 Implement [Feature] form - - Fields: [list] - - Validation: client-side - - Submit handling - - [ ] 3.4 Build [View] page - - Layout: [description] - - Components: [list] - - Match mockup: `planning/visuals/[file]` - - [ ] 3.5 Apply base styles - - Follow existing design system - - Use variables from: [style file] - - [ ] 3.6 Implement responsive design - - Mobile: 320px - 768px - - Tablet: 768px - 1024px - - Desktop: 1024px+ - - [ ] 3.7 Add interactions and animations - - Hover states - - Transitions - - Loading states - - [ ] 3.8 Ensure UI component tests pass - - Run ONLY the 2-8 tests written in 3.1 - - Verify critical component behaviors work - - Do NOT run the entire test suite at this stage - -**Acceptance Criteria:** -- The 2-8 tests written in 3.1 pass -- Components render correctly -- Forms validate and submit -- Matches visual design - -### Testing - -#### Task Group 4: Test Review & Gap Analysis -**Dependencies:** Task Groups 1-3 - -- [ ] 4.0 Review existing tests and fill critical gaps only - - [ ] 4.1 Review tests from Task Groups 1-3 - - Review the 2-8 tests written by database-engineer (Task 1.1) - - Review the 2-8 tests written by api-engineer (Task 2.1) - - Review the 2-8 tests written by ui-designer (Task 3.1) - - Total existing tests: approximately 6-24 tests - - [ ] 4.2 Analyze test coverage gaps for THIS feature only - - Identify critical user workflows that lack test coverage - - Focus ONLY on gaps related to this spec's feature requirements - - Do NOT assess entire application test coverage - - Prioritize end-to-end workflows over unit test gaps - - [ ] 4.3 Write up to 10 additional strategic tests maximum - - Add maximum of 10 new tests to fill identified critical gaps - - Focus on integration points and end-to-end workflows - - Do NOT write comprehensive coverage for all scenarios - - Skip edge cases, performance tests, and accessibility tests unless business-critical - - [ ] 4.4 Run feature-specific tests only - - Run ONLY tests related to this spec's feature (tests from 1.1, 2.1, 3.1, and 4.3) - - Expected total: approximately 16-34 tests maximum - - Do NOT run the entire application test suite - - Verify critical workflows pass - -**Acceptance Criteria:** -- All feature-specific tests pass (approximately 16-34 tests total) -- Critical user workflows for this feature are covered -- No more than 10 additional tests added when filling in testing gaps -- Testing focused exclusively on this spec's feature requirements - -## Execution Order - -Recommended implementation sequence: -1. Database Layer (Task Group 1) -2. API Layer (Task Group 2) -3. Frontend Design (Task Group 3) -4. Test Review & Gap Analysis (Task Group 4) -``` - -**Note**: Adapt this structure based on the actual feature requirements. Some features may need: -- Different task groups (e.g., email notifications, payment processing, data migration) -- Different execution order based on dependencies -- More or fewer sub-tasks per group - -## Important Constraints - -- **Create tasks that are specific and verifiable** -- **Group related tasks:** For example, group back-end engineering tasks together and front-end UI tasks together. -- **Limit test writing during development**: - - Each task group (1-3) should write 2-8 focused tests maximum - - Tests should cover only critical behaviors, not exhaustive coverage - - Test verification should run ONLY the newly written tests, not the entire suite - - If there is a dedicated test coverage group for filling in gaps in test coverage, this group should add only a maximum of 10 additional tests IF NECESSARY to fill critical gaps -- **Use a focused test-driven approach** where each task group starts with writing 2-8 tests (x.1 sub-task) and ends with running ONLY those tests (final sub-task) -- **Include acceptance criteria** for each task group -- **Reference visual assets** if visuals are available diff --git a/profiles/default/workflows/implementation/implement-tasks.md b/profiles/default/workflows/implementation/implement-tasks.md deleted file mode 100644 index 048741e2..00000000 --- a/profiles/default/workflows/implementation/implement-tasks.md +++ /dev/null @@ -1,20 +0,0 @@ -Implement all tasks assigned to you and ONLY those task(s) that have been assigned to you. - -## Implementation process: - -1. Analyze the provided spec.md, requirements.md, and visuals (if any) -2. Analyze patterns in the codebase according to its built-in workflow -3. Implement the assigned task group according to requirements and standards -4. Update `agent-os/specs/[this-spec]/tasks.md` to update the tasks you've implemented to mark that as done by updating their checkbox to checked state: `- [x]` - -## Guide your implementation using: -- **The existing patterns** that you've found and analyzed in the codebase. -- **Specific notes provided in requirements.md, spec.md AND/OR tasks.md** -- **Visuals provided (if any)** which would be located in `agent-os/specs/[this-spec]/planning/visuals/` -- **User Standards & Preferences** which are defined below. - -## Self-verify and test your work by: -- Running ONLY the tests you've written (if any) and ensuring those tests pass. -- IF your task involves user-facing UI, and IF you have access to browser testing tools, open a browser and use the feature you've implemented as if you are a user to ensure a user can use the feature in the intended way. - - Take screenshots of the views and UI elements you've tested and store those in `agent-os/specs/[this-spec]/verification/screenshots/`. Do not store screenshots anywhere else in the codebase other than this location. - - Analyze the screenshot(s) you've taken to check them against your current requirements. diff --git a/profiles/default/workflows/implementation/verification/create-verification-report.md b/profiles/default/workflows/implementation/verification/create-verification-report.md deleted file mode 100644 index 2509ef36..00000000 --- a/profiles/default/workflows/implementation/verification/create-verification-report.md +++ /dev/null @@ -1,80 +0,0 @@ -Create your final verification report in `agent-os/specs/[this-spec]/verifications/final-verification.md`. - -The content of this report should follow this structure: - -```markdown -# Verification Report: [Spec Title] - -**Spec:** `[spec-name]` -**Date:** [Current Date] -**Verifier:** implementation-verifier -**Status:** βœ… Passed | ⚠️ Passed with Issues | ❌ Failed - ---- - -## Executive Summary - -[Brief 2-3 sentence overview of the verification results and overall implementation quality] - ---- - -## 1. Tasks Verification - -**Status:** βœ… All Complete | ⚠️ Issues Found - -### Completed Tasks -- [x] Task Group 1: [Title] - - [x] Subtask 1.1 - - [x] Subtask 1.2 -- [x] Task Group 2: [Title] - - [x] Subtask 2.1 - -### Incomplete or Issues -[List any tasks that were found incomplete or have issues, or note "None" if all complete] - ---- - -## 2. Documentation Verification - -**Status:** βœ… Complete | ⚠️ Issues Found - -### Implementation Documentation -- [x] Task Group 1 Implementation: `implementations/1-[task-name]-implementation.md` -- [x] Task Group 2 Implementation: `implementations/2-[task-name]-implementation.md` - -### Verification Documentation -[List verification documents from area verifiers if applicable] - -### Missing Documentation -[List any missing documentation, or note "None"] - ---- - -## 3. Roadmap Updates - -**Status:** βœ… Updated | ⚠️ No Updates Needed | ❌ Issues Found - -### Updated Roadmap Items -- [x] [Roadmap item that was marked complete] - -### Notes -[Any relevant notes about roadmap updates, or note if no updates were needed] - ---- - -## 4. Test Suite Results - -**Status:** βœ… All Passing | ⚠️ Some Failures | ❌ Critical Failures - -### Test Summary -- **Total Tests:** [count] -- **Passing:** [count] -- **Failing:** [count] -- **Errors:** [count] - -### Failed Tests -[List any failing tests with their descriptions, or note "None - all tests passing"] - -### Notes -[Any additional context about test results, known issues, or regressions] -``` diff --git a/profiles/default/workflows/implementation/verification/run-all-tests.md b/profiles/default/workflows/implementation/verification/run-all-tests.md deleted file mode 100644 index eff528df..00000000 --- a/profiles/default/workflows/implementation/verification/run-all-tests.md +++ /dev/null @@ -1,5 +0,0 @@ -Run the entire tests suite for the application so that ALL tests run. Verify how many tests are passing and how many have failed or produced errors. - -Include these counts and the list of failed tests in your final verification report. - -DO NOT attempt to fix any failing tests. Just note their failures in your final verification report. diff --git a/profiles/default/workflows/implementation/verification/update-roadmap.md b/profiles/default/workflows/implementation/verification/update-roadmap.md deleted file mode 100644 index 81cd1c95..00000000 --- a/profiles/default/workflows/implementation/verification/update-roadmap.md +++ /dev/null @@ -1 +0,0 @@ -Open `agent-os/product/roadmap.md` and check to see whether any item(s) match the description of the current spec that has just been implemented. If so, then ensure that these item(s) are marked as completed by updating their checkbox(s) to `- [x]`. diff --git a/profiles/default/workflows/implementation/verification/verify-tasks.md b/profiles/default/workflows/implementation/verification/verify-tasks.md deleted file mode 100644 index 2f4bb053..00000000 --- a/profiles/default/workflows/implementation/verification/verify-tasks.md +++ /dev/null @@ -1,9 +0,0 @@ -Check `agent-os/specs/[this-spec]/tasks.md` and ensure that all tasks and their sub-tasks are marked as completed with `- [x]`. - -If a task is still marked incomplete, then verify that it has in fact been completed by checking the following: -- Run a brief spot check in the code to find evidence that this task's details have been implemented -- Check for existence of an implementation report titled using this task's title in `agent-os/spec/[this-spec]/implementation/` folder. - -IF you have concluded that this task has been completed, then mark it's checkbox and its' sub-tasks checkboxes as completed with `- [x]`. - -IF you have concluded that this task has NOT been completed, then mark this checkbox with ⚠️ and note it's incompleteness in your verification report. diff --git a/profiles/default/workflows/planning/create-product-mission.md b/profiles/default/workflows/planning/create-product-mission.md deleted file mode 100644 index ca07c6a8..00000000 --- a/profiles/default/workflows/planning/create-product-mission.md +++ /dev/null @@ -1,52 +0,0 @@ -Create `agent-os/product/mission.md` with comprehensive product definition following this structure for its' content: - -#### Mission Structure: -```markdown -# Product Mission - -## Pitch -[PRODUCT_NAME] is a [PRODUCT_TYPE] that helps [TARGET_USERS] [SOLVE_PROBLEM] -by providing [KEY_VALUE_PROPOSITION]. - -## Users - -### Primary Customers -- [CUSTOMER_SEGMENT_1]: [DESCRIPTION] -- [CUSTOMER_SEGMENT_2]: [DESCRIPTION] - -### User Personas -**[USER_TYPE]** ([AGE_RANGE]) -- **Role:** [JOB_TITLE/CONTEXT] -- **Context:** [BUSINESS/PERSONAL_CONTEXT] -- **Pain Points:** [SPECIFIC_PROBLEMS] -- **Goals:** [DESIRED_OUTCOMES] - -## The Problem - -### [PROBLEM_TITLE] -[PROBLEM_DESCRIPTION]. [QUANTIFIABLE_IMPACT]. - -**Our Solution:** [SOLUTION_APPROACH] - -## Differentiators - -### [DIFFERENTIATOR_TITLE] -Unlike [COMPETITOR/ALTERNATIVE], we provide [SPECIFIC_ADVANTAGE]. -This results in [MEASURABLE_BENEFIT]. - -## Key Features - -### Core Features -- **[FEATURE_NAME]:** [USER_BENEFIT_DESCRIPTION] - -### Collaboration Features -- **[FEATURE_NAME]:** [USER_BENEFIT_DESCRIPTION] - -### Advanced Features -- **[FEATURE_NAME]:** [USER_BENEFIT_DESCRIPTION] -``` - -#### Important Constraints - -- **Focus on user benefits** in feature descriptions, not technical details -- **Keep it concise** and easy for users to scan and get the more important concepts quickly diff --git a/profiles/default/workflows/planning/create-product-roadmap.md b/profiles/default/workflows/planning/create-product-roadmap.md deleted file mode 100644 index af73f44f..00000000 --- a/profiles/default/workflows/planning/create-product-roadmap.md +++ /dev/null @@ -1,47 +0,0 @@ -Generate `agent-os/product/roadmap.md` with an ordered feature checklist: - -Do not include any tasks for initializing a new codebase or bootstrapping a new application. Assume the user is already inside the project's codebase and has a bare-bones application initialized. - -#### Creating the Roadmap: - -1. **Review the Mission** - Read `agent-os/product/mission.md` to understand the product's goals, target users, and success criteria. - -2. **Identify Features** - Based on the mission, determine the list of concrete features needed to achieve the product vision. - -3. **Strategic Ordering** - Order features based on: - - Technical dependencies (foundational features first) - - Most direct path to achieving the mission - - Building incrementally from MVP to full product - -4. **Create the Roadmap** - Use the structure below as your template. Replace all bracketed placeholders (e.g., `[FEATURE_NAME]`, `[DESCRIPTION]`, `[EFFORT]`) with real content that you create based on the mission. - -#### Roadmap Structure: -```markdown -# Product Roadmap - -1. [ ] [FEATURE_NAME] β€” [1-2 SENTENCE DESCRIPTION OF COMPLETE, TESTABLE FEATURE] `[EFFORT]` -2. [ ] [FEATURE_NAME] β€” [1-2 SENTENCE DESCRIPTION OF COMPLETE, TESTABLE FEATURE] `[EFFORT]` -3. [ ] [FEATURE_NAME] β€” [1-2 SENTENCE DESCRIPTION OF COMPLETE, TESTABLE FEATURE] `[EFFORT]` -4. [ ] [FEATURE_NAME] β€” [1-2 SENTENCE DESCRIPTION OF COMPLETE, TESTABLE FEATURE] `[EFFORT]` -5. [ ] [FEATURE_NAME] β€” [1-2 SENTENCE DESCRIPTION OF COMPLETE, TESTABLE FEATURE] `[EFFORT]` -6. [ ] [FEATURE_NAME] β€” [1-2 SENTENCE DESCRIPTION OF COMPLETE, TESTABLE FEATURE] `[EFFORT]` -7. [ ] [FEATURE_NAME] β€” [1-2 SENTENCE DESCRIPTION OF COMPLETE, TESTABLE FEATURE] `[EFFORT]` -8. [ ] [FEATURE_NAME] β€” [1-2 SENTENCE DESCRIPTION OF COMPLETE, TESTABLE FEATURE] `[EFFORT]` - -> Notes -> - Order items by technical dependencies and product architecture -> - Each item should represent an end-to-end (frontend + backend) functional and testable feature -``` - -Effort scale: -- `XS`: 1 day -- `S`: 2-3 days -- `M`: 1 week -- `L`: 2 weeks -- `XL`: 3+ weeks - -#### Important Constraints - -- **Make roadmap actionable** - include effort estimates and dependencies -- **Priorities guided by mission** - When deciding on order, aim for the most direct path to achieving the mission as documented in mission.md -- **Ensure phases are achievable** - start with MVP, build incrementally diff --git a/profiles/default/workflows/planning/create-product-tech-stack.md b/profiles/default/workflows/planning/create-product-tech-stack.md deleted file mode 100644 index a57d4d0f..00000000 --- a/profiles/default/workflows/planning/create-product-tech-stack.md +++ /dev/null @@ -1,20 +0,0 @@ -Create `agent-os/product/tech-stack.md` with a list of all tech stack choices that cover all aspects of this product's codebase. - -### Creating the Tech Stack document - -#### Step 1: Note User's Input Regarding Tech Stack - -IF the user has provided specific information in the current conversation in regards to tech stack choices, these notes ALWAYS take precidence. These must be reflected in your final `tech-stack.md` document that you will create. - -#### Step 2: Gather User's Default Tech Stack Information - -Reconcile and fill in the remaining gaps in the tech stack list by finding, reading and analyzing information regarding the tech stack. Find this information in the following sources, in this order: - -1. If user has provided their default tech stack under "User Standards & Preferences Compliance", READ and analyze this document. -2. If the current project has any of these files, read them to find information regarding tech stack choices for this codebase: - - `claude.md` - - `agents.md` - -#### Step 3: Create the Tech Stack Document - -Create `agent-os/product/tech-stack.md` and populate it with the final list of all technical stack choices, reconciled between the information the user has provided to you and the information found in provided sources. diff --git a/profiles/default/workflows/planning/gather-product-info.md b/profiles/default/workflows/planning/gather-product-info.md deleted file mode 100644 index ab0336f0..00000000 --- a/profiles/default/workflows/planning/gather-product-info.md +++ /dev/null @@ -1,25 +0,0 @@ -Collect comprehensive product information from the user: - -```bash -# Check if product folder already exists -if [ -d "agent-os/product" ]; then - echo "Product documentation already exists. Review existing files or start fresh?" - # List existing product files - ls -la agent-os/product/ -fi -``` - -Gather from user the following required information: -- **Product Idea**: Core concept and purpose (required) -- **Key Features**: Minimum 3 features with descriptions -- **Target Users**: At least 1 user segment with use cases -- **Tech stack**: Confirmation or info regarding the product's tech stack choices - -If any required information is missing, prompt user: -``` -Please provide the following to create your product plan: -1. Main idea for the product -2. List of key features (minimum 3) -3. Target users and use cases (minimum 1) -4. Will this product use your usual tech stack choices or deviate in any way? -``` diff --git a/profiles/default/workflows/specification/initialize-spec.md b/profiles/default/workflows/specification/initialize-spec.md deleted file mode 100644 index a452ae30..00000000 --- a/profiles/default/workflows/specification/initialize-spec.md +++ /dev/null @@ -1,82 +0,0 @@ -# Spec Initialization - -## Core Responsibilities - -1. **Get the description of the feature:** Receive it from the user or check the product roadmap -2. **Initialize Spec Structure**: Create the spec folder with date prefix -3. **Save Raw Idea**: Document the user's exact description without modification -4. **Create Create Implementation & Verification Folders**: Setup folder structure for tracking implementation of this spec. -5. **Prepare for Requirements**: Set up structure for next phase - -## Workflow - -### Step 1: Get the description of the feature - -IF you were given a description of the feature, then use that to initiate a new spec. - -OTHERWISE follow these steps to get the description: - -1. Check `@agent-os/product/roadmap.md` to find the next feature in the roadmap. -2. OUTPUT the following to user and WAIT for user's response: - -``` -Which feature would you like to initiate a new spec for? - -- The roadmap shows [feature description] is next. Go with that? -- Or provide a description of a feature you'd like to initiate a spec for. -``` - -**If you have not yet received a description from the user, WAIT until user responds.** - -### Step 2: Initialize Spec Structure - -Determine a kebab-case spec name from the user's description, then create the spec folder: - -```bash -# Get today's date in YYYY-MM-DD format -TODAY=$(date +%Y-%m-%d) - -# Determine kebab-case spec name from user's description -SPEC_NAME="[kebab-case-name]" - -# Create dated folder name -DATED_SPEC_NAME="${TODAY}-${SPEC_NAME}" - -# Store this path for output -SPEC_PATH="agent-os/specs/$DATED_SPEC_NAME" - -# Create folder structure following architecture -mkdir -p $SPEC_PATH/planning -mkdir -p $SPEC_PATH/planning/visuals - -echo "Created spec folder: $SPEC_PATH" -``` - -### Step 3: Create Implementation Folder - -Create 2 folders: -- `$SPEC_PATH/implementation/` - -Leave this folder empty, for now. Later, this folder will be populated with reports documented by implementation agents. - -### Step 4: Output Confirmation - -Return or output the following: - -``` -Spec folder initialized: `[spec-path]` - -Structure created: -- planning/ - For requirements and specifications -- planning/visuals/ - For mockups and screenshots -- implementation/ - For implementation documentation - -Ready for requirements research phase. -``` - -## Important Constraints - -- Always use dated folder names (YYYY-MM-DD-spec-name) -- Pass the exact spec path back to the orchestrator -- Follow folder structure exactly -- Implementation folder should be empty, for now diff --git a/profiles/default/workflows/specification/research-spec.md b/profiles/default/workflows/specification/research-spec.md deleted file mode 100644 index 393dfcf3..00000000 --- a/profiles/default/workflows/specification/research-spec.md +++ /dev/null @@ -1,262 +0,0 @@ -# Spec Research - -## Core Responsibilities - -1. **Read Initial Idea**: Load the raw idea from initialization.md -2. **Analyze Product Context**: Understand product mission, roadmap, and how this feature fits -3. **Ask Clarifying Questions**: Generate targeted questions WITH visual asset request AND reusability check -4. **Process Answers**: Analyze responses and any provided visuals -5. **Ask Follow-ups**: Based on answers and visual analysis if needed -6. **Save Requirements**: Document the requirements you've gathered to a single file named: `[spec-path]/planning/requirements.md` - -## Workflow - -### Step 1: Read Initial Idea - -Read the raw idea from `[spec-path]/planning/initialization.md` to understand what the user wants to build. - -### Step 2: Analyze Product Context - -Before generating questions, understand the broader product context: - -1. **Read Product Mission**: Load `agent-os/product/mission.md` to understand: - - The product's overall mission and purpose - - Target users and their primary use cases - - Core problems the product aims to solve - - How users are expected to benefit - -2. **Read Product Roadmap**: Load `agent-os/product/roadmap.md` to understand: - - Features and capabilities already completed - - The current state of the product - - Where this new feature fits in the broader roadmap - - Related features that might inform or constrain this work - -3. **Read Product Tech Stack**: Load `agent-os/product/tech-stack.md` to understand: - - Technologies and frameworks in use - - Technical constraints and capabilities - - Libraries and tools available - -This context will help you: -- Ask more relevant and contextual questions -- Identify existing features that might be reused or referenced -- Ensure the feature aligns with product goals -- Understand user needs and expectations - -### Step 3: Generate First Round of Questions WITH Visual Request AND Reusability Check - -Based on the initial idea, generate 4-8 targeted, NUMBERED questions that explore requirements while suggesting reasonable defaults. - -**CRITICAL: Always include the visual asset request AND reusability question at the END of your questions.** - -**Question generation guidelines:** -- Start each question with a number -- Propose sensible assumptions based on best practices -- Frame questions as "I'm assuming X, is that correct?" -- Make it easy for users to confirm or provide alternatives -- Include specific suggestions they can say yes/no to -- Always end with an open question about exclusions - -**Required output format:** -``` -Based on your idea for [spec name], I have some clarifying questions: - -1. I assume [specific assumption]. Is that correct, or [alternative]? -2. I'm thinking [specific approach]. Should we [alternative]? -3. [Continue with numbered questions...] -[Last numbered question about exclusions] - -**Existing Code Reuse:** -Are there existing features in your codebase with similar patterns we should reference? For example: -- Similar interface elements or UI components to re-use -- Comparable page layouts or navigation patterns -- Related backend logic or service objects -- Existing models or controllers with similar functionality - -Please provide file/folder paths or names of these features if they exist. - -**Visual Assets Request:** -Do you have any design mockups, wireframes, or screenshots that could help guide the development? - -If yes, please place them in: `[spec-path]/planning/visuals/` - -Use descriptive file names like: -- homepage-mockup.png -- dashboard-wireframe.jpg -- lofi-form-layout.png -- mobile-view.png -- existing-ui-screenshot.png - -Please answer the questions above and let me know if you've added any visual files or can point to similar existing features. -``` - -**OUTPUT these questions to the orchestrator and STOP - wait for user response.** - -### Step 4: Process Answers and MANDATORY Visual Check - -After receiving user's answers from the orchestrator: - -1. Store the user's answers for later documentation - -2. **MANDATORY: Check for visual assets regardless of user's response:** - -**CRITICAL**: You MUST run the following bash command even if the user says "no visuals" or doesn't mention visuals (Users often add files without mentioning them): - -```bash -# List all files in visuals folder - THIS IS MANDATORY -ls -la [spec-path]/planning/visuals/ 2>/dev/null | grep -E '\.(png|jpg|jpeg|gif|svg|pdf)$' || echo "No visual files found" -``` - -3. IF visual files are found (bash command returns filenames): - - Use Read tool to analyze EACH visual file found - - Note key design elements, patterns, and user flows - - Document observations for each file - - Check filenames for low-fidelity indicators (lofi, lo-fi, wireframe, sketch, rough, etc.) - -4. IF user provided paths or names of similar features: - - Make note of these paths/names for spec-writer to reference - - DO NOT explore them yourself (to save time), but DO document their names for future reference by the spec-writer. - -### Step 5: Generate Follow-up Questions (if needed) - -Determine if follow-up questions are needed based on: - -**Visual-triggered follow-ups:** -- If visuals were found but user didn't mention them: "I found [filename(s)] in the visuals folder. Let me analyze these for the specification." -- If filenames contain "lofi", "lo-fi", "wireframe", "sketch", or "rough": "I notice you've provided [filename(s)] which appear to be wireframes/low-fidelity mockups. Should we treat these as layout and structure guides rather than exact design specifications, using our application's existing styling instead?" -- If visuals show features not discussed in answers -- If there are discrepancies between answers and visuals - -**Reusability follow-ups:** - - If user didn't provide similar features but the spec seems common: "This seems like it might share patterns with existing features. Could you point me to any similar forms/pages/logic in your app?" -- If provided paths seem incomplete you can ask something like: "You mentioned [feature]. Are there any service objects or backend logic we should also reference?" - -**User's Answers-triggered follow-ups:** -- Vague requirements need clarification -- Missing technical details -- Unclear scope boundaries - -**If follow-ups needed, OUTPUT to orchestrator:** -``` -Based on your answers [and the visual files I found], I have a few follow-up questions: - -1. [Specific follow-up question] -2. [Another follow-up if needed] - -Please provide these additional details. -``` - -**Then STOP and wait for responses.** - -### Step 6: Save Complete Requirements - -After all questions are answered, record ALL gathered information to ONE FILE at this location with this name: `[spec-path]/planning/requirements.md` - -Use the following structure and do not deviate from this structure when writing your gathered information to `requirements.md`. Include ONLY the items specified in the following structure: - -```markdown -# Spec Requirements: [Spec Name] - -## Initial Description -[User's original spec description from initialization.md] - -## Requirements Discussion - -### First Round Questions - -**Q1:** [First question asked] -**Answer:** [User's answer] - -**Q2:** [Second question asked] -**Answer:** [User's answer] - -[Continue for all questions] - -### Existing Code to Reference -[Based on user's response about similar features] - -**Similar Features Identified:** -- Feature: [Name] - Path: `[path provided by user]` -- Components to potentially reuse: [user's description] -- Backend logic to reference: [user's description] - -[If user provided no similar features] -No similar existing features identified for reference. - -### Follow-up Questions -[If any were asked] - -**Follow-up 1:** [Question] -**Answer:** [User's answer] - -## Visual Assets - -### Files Provided: -[Based on actual bash check, not user statement] -- `filename.png`: [Description of what it shows from your analysis] -- `filename2.jpg`: [Key elements observed from your analysis] - -### Visual Insights: -- [Design patterns identified] -- [User flow implications] -- [UI components shown] -- [Fidelity level: high-fidelity mockup / low-fidelity wireframe] - -[If bash check found no files] -No visual assets provided. - -## Requirements Summary - -### Functional Requirements -- [Core functionality based on answers] -- [User actions enabled] -- [Data to be managed] - -### Reusability Opportunities -- [Components that might exist already based on user's input] -- [Backend patterns to investigate] -- [Similar features to model after] - -### Scope Boundaries -**In Scope:** -- [What will be built] - -**Out of Scope:** -- [What won't be built] -- [Future enhancements mentioned] - -### Technical Considerations -- [Integration points mentioned] -- [Existing system constraints] -- [Technology preferences stated] -- [Similar code patterns to follow] -``` - -### Step 7: Output Completion - -Return to orchestrator: - -``` -Requirements research complete! - -βœ… Processed [X] clarifying questions -βœ… Visual check performed: [Found and analyzed Y files / No files found] -βœ… Reusability opportunities: [Identified Z similar features / None identified] -βœ… Requirements documented comprehensively - -Requirements saved to: `[spec-path]/planning/requirements.md` - -Ready for specification creation. -``` - -## Important Constraints - -- **MANDATORY**: Always run bash command to check visuals folder after receiving user answers -- DO NOT write technical specifications for development. Just record your findings from information gathering to this single file: `[spec-path]/planning/requirements.md`. -- Visual check is based on actual file(s) found via bash, NOT user statements -- Check filenames for low-fidelity indicators and clarify design intent if found -- Ask about existing similar features to promote code reuse -- Keep follow-ups minimal (1-3 questions max) -- Save user's exact answers, not interpretations -- Document all visual findings including fidelity level -- Document paths to similar features for spec-writer to reference -- OUTPUT questions and STOP to wait for orchestrator to relay responses diff --git a/profiles/default/workflows/specification/verify-spec.md b/profiles/default/workflows/specification/verify-spec.md deleted file mode 100644 index f4c567cf..00000000 --- a/profiles/default/workflows/specification/verify-spec.md +++ /dev/null @@ -1,282 +0,0 @@ -# Spec Verification - -## Core Responsibilities - -1. **Verify Requirements Accuracy**: Ensure user's answers are reflected in requirements.md -2. **Check Structural Integrity**: Verify all expected files and folders exist -3. **Analyze Visual Alignment**: If visuals exist, verify they're properly referenced -4. **Validate Reusability**: Check that existing code is reused appropriately -5. **Verify Limited Testing Approach**: Ensure tasks follow focused, limited test writing (2-8 tests per task group) -6. **Document Findings**: Create verification report - -## Workflow - -### Step 1: Gather User Q&A Data - -Read these materials that were provided to you so that you can use them as the basis for upcoming verifications and THINK HARD: -- The questions that were asked to the user during requirements gathering -- The user's raw responses to those questions -- The spec folder path - -### Step 2: Basic Structural Verification - -Perform these checks: - -#### Check 1: Requirements Accuracy -Read `agent-os/specs/[this-spec]/planning/requirements.md` and verify: -- All user answers from the Q&A are accurately captured -- No answers are missing or misrepresented -- Any follow-up questions and answers are included -- Reusability opportunities are documented (paths or names of similar features)β€”but DO NOT search and read these paths. Just verify existence of their documentation in requirements.md. -- Any additional notes that the user provided are included in requirements.md. - -#### Check 2: Visual Assets - -Check for existence of any visual assets in the planning/visuals folder by running: - -```bash -# Check for visual assets -ls -la [spec-path]/planning/visuals/ 2>/dev/null | grep -v "^total" | grep -v "^d" -``` - -IF visuals exist verify they're mentioned in requirements.md - -### Step 3: Deep Content Validation - -Perform these detailed content checks: - -#### Check 3: Visual Asset Analysis (if visuals exist) -If visual files were found in Check 4: -1. **Read each visual file** in `agent-os/specs/[this-spec]/planning/visuals/` -2. **Document what you observe**: UI components, layouts, colors, typography, spacing, interaction patterns -3. **Verify these design elements appear in**: - - `agent-os/specs/[this-spec]/spec.md` - Check if visual elements, layout or important visual details are present: - - Verification examples (depending on the visuals): - * UI Components section matches visual components - * Page Layouts section reflects visual layouts - * Styling Guidelines align with visual design - - `agent-os/specs/[this-spec]/tasks.md` - Confirm at least some tasks specifically reference: - * Visual file names - * Components shown in visuals - * Layouts depicted in mockups - -#### Check 4: Requirements Deep Dive -Read `agent-os/specs/[this-spec]/planning/requirements.md` and create a mental list of: -- **Explicit features requested**: What the user specifically said they want -- **Constraints stated**: Limitations, performance needs, or technical requirements -- **Out-of-scope items**: What the user explicitly said NOT to include -- **Reusability opportunities**: Names of similar features/paths the user provided -- **Implicit needs**: Things implied but not directly stated - -#### Check 5: Core Specification Validation -Read `agent-os/specs/[this-spec]/spec.md` and verify each section: -1. **Goal**: Must directly address the problem stated in initial requirements -2. **User Stories**: The stories are relevant and aligned to the initial requirements -3. **Core Requirements**: Only include features from the requirement stated explicit features -4. **Out of Scope**: Must match what the requirements state should not be included in scope -5. **Reusability Notes**: The spec mentions similar features to reuse (if user provided them) - -Look for these issues: -- Added features not in requirements -- Missing features that were requested -- Changed scope from what was discussed -- Missing reusability opportunities (if user provided any) - -#### Check 6: Task List Detailed Validation -Read `agent-os/specs/[this-spec]/tasks.md` and check each task group's tasks: -1. **Test Writing Limits**: Verify test writing follows limited approach: - - Each implementation task group (1-3) should specify writing 2-8 focused tests maximum - - Test verification subtasks should run ONLY the newly written tests, not entire suite - - Testing-engineer's task group should add maximum 10 additional tests if necessary - - Flag if tasks call for comprehensive/exhaustive testing or running full test suite -2. **Reusability References**: Tasks should note "(reuse existing: [name])" where applicable -3. **Specificity**: Each task must reference a specific feature/component -4. **Traceability**: Each task must trace back to requirements -5. **Scope**: No tasks for features not in requirements -6. **Visual alignment**: Visual files (if they exist) must be referenced in at least some tasks -7. **Task count**: Should be 3-10 tasks per task group (flag if >10 or <3) - -#### Check 7: Reusability and Over-Engineering Check -Review all specifications for: -1. **Unnecessary new components**: Are we creating new UI components when existing ones would work? -2. **Duplicated logic**: Are we recreating backend logic that already exists? -3. **Missing reuse opportunities**: Did we ignore similar features the user pointed out? -4. **Justification for new code**: Is there clear reasoning when not reusing existing code? - -### Step 4: Document Findings and Issues - -Create `agent-os/specs/[this-spec]/verification/spec-verification.md` with the following structure: - -```markdown -# Specification Verification Report - -## Verification Summary -- Overall Status: βœ… Passed / ⚠️ Issues Found / ❌ Failed -- Date: [Current date] -- Spec: [Spec name] -- Reusability Check: βœ… Passed / ⚠️ Concerns / ❌ Failed -- Test Writing Limits: βœ… Compliant / ⚠️ Partial / ❌ Excessive Testing - -## Structural Verification (Checks 1-2) - -### Check 1: Requirements Accuracy -[Document any discrepancies between Q&A and requirements.md] -βœ… All user answers accurately captured -βœ… Reusability opportunities documented -[OR specific issues like:] -⚠️ User mentioned similar feature at "app/views/posts" but not in requirements - -### Check 2: Visual Assets -[Document visual files found and verification] -βœ… Found 3 visual files, all referenced in requirements.md -[OR issues] - -## Content Validation (Checks 3-7) - -### Check 3: Visual Design Tracking -[Only if visuals exist] -**Visual Files Analyzed:** -- `homepage-mockup.png`: Shows header with logo, 3-column grid, footer -- `form-design.jpg`: Shows 5 form fields with specific labels - -**Design Element Verification:** -- Header with logo: βœ… Specified in spec.md -- 3-column grid: ⚠️ Not in tasks.md -- Form fields: βœ… All 5 fields in spec.md -[List each visual element and its status] - -### Check 4: Requirements Coverage -**Explicit Features Requested:** -- Feature A: βœ… Covered in specs -- Feature B: ❌ Missing from specs -[List all] - -**Reusability Opportunities:** -- Similar forms at app/views/posts: βœ… Referenced in spec -- UserService pattern: ⚠️ Not leveraged in spec - -**Out-of-Scope Items:** -- Correctly excluded: [list] -- Incorrectly included: [list] - -### Check 5: Core Specification Issues -- Goal alignment: βœ… Matches user need -- User stories: ⚠️ Story #3 not from requirements -- Core requirements: βœ… All from user discussion -- Out of scope: ❌ Missing "no payment processing" -- Reusability notes: ⚠️ Missing reference to similar features - -### Check 6: Task List Issues - -**Test Writing Limits:** -- βœ… Task Group 1 specifies 2-8 focused tests -- ❌ Task Group 2 calls for "comprehensive test coverage" (violates limits) -- ⚠️ Task Group 3 doesn't specify test limits -- ❌ Testing-engineer group plans 25 additional tests (exceeds 10 max) -- ❌ Tasks call for running entire test suite (should run only new tests) -[OR if compliant:] -- βœ… All task groups specify 2-8 focused tests maximum -- βœ… Test verification limited to newly written tests only -- βœ… Testing-engineer adds maximum 10 tests - -**Reusability References:** -- ❌ Task 3.2 doesn't mention reusing existing form partial -- ❌ Task 4.3 recreates validation that exists in UserValidator - -**Task Specificity:** -- ⚠️ Task 3.4 "Implement best practices" too vague -- ⚠️ Task 4.2 "Add validation" needs specifics - -**Visual References:** -- ❌ Interface tasks don't mention mockup files -- ❌ No tasks for header component from mockup - -**Task Count:** -- Structure: 6 tasks βœ… -- Interface: 12 tasks ⚠️ (possibly over-engineered) - -### Check 7: Reusability and Over-Engineering -**Unnecessary New Components:** -- ❌ Creating new FormField component when shared/_form_field.erb exists -- ❌ New DataTable when components/data_table.erb available - -**Duplicated Logic:** -- ⚠️ EmailValidator being recreated (exists in app/validators/) -- ⚠️ Similar pagination logic already in PaginationService - -**Missing Reuse Opportunities:** -- User pointed to app/views/posts but not referenced -- Existing test factories not mentioned in Quality spec - -## Critical Issues -[Issues that must be fixed before implementation] -1. Not reusing existing FormField component - will create duplication -3. Visual mockup ignored: Sidebar in mockup but not specified - -## Minor Issues -[Issues that should be addressed but don't block progress] -1. Vague task descriptions -2. Extra database field that wasn't requested -3. Could leverage existing validators - -## Over-Engineering Concerns -[Features/complexity added beyond requirements] -1. Creating new components instead of reusing: FormField, DataTable -2. Audit logging system not requested -3. Complex state management for simple form -4. Excessive test coverage planned (e.g., 50+ tests when 16-34 is appropriate) -5. Comprehensive test suite requirements violating focused testing approach - -## Recommendations -1. Update spec to reuse existing form components -2. Reorder tasks to take dependencies into account -3. Add reusability analysis sections to spec -4. Update tasks to reference existing code where applicable -5. Remove unnecessary new component creation - -## Conclusion -[Overall assessment: Ready for implementation? Needs revision? Major concerns?] -``` - -### Step 5: Output Summary - -OUTPUT the following: - -``` -Specification verification complete! - -βœ… Verified requirements accuracy -βœ… Checked structural integrity -βœ… Validated specification alignment -βœ… Verified test writing limits (2-8 tests per task group, ~16-34 total) -[If visuals] βœ… Analyzed [X] visual assets -⚠️ Reusability check: [Y issues found] - -[If passed] -All specifications accurately reflect requirements, follow limited testing approach, and properly leverage existing code - -[If issues found] -⚠️ Found [X] issues requiring attention: -- [Number] reusability issues -- [Number] test writing limit violations -- [Number] critical issues -- [Number] minor issues -- [Number] over-engineering concerns - -See agent-os/specs/[this-spec]/verification/spec-verification.md for full details. -``` - -## Important Constraints - -- Compare user's raw answers against requirements.md exactly -- Check for reusability opportunities and verify that they're documented but DO NOT search and explore the codebase yourself. -- Verify test writing limits strictly: Flag any tasks that call for comprehensive testing, exhaustive coverage, or running full test suites -- Expected test counts: Implementation task groups should write 2-8 tests each, testing-engineer adds maximum 10, total ~16-34 tests per feature -- Don't add new requirements or specifications -- Focus on alignment and accuracy, not style -- Be specific about any issues found -- Distinguish between critical and minor issues -- Always check visuals even if not mentioned in requirements -- Document everything for transparency -- Visual design elements must be traceable through all specs -- Reusability should be prioritized in specs and tasks over creating new code diff --git a/profiles/default/workflows/specification/write-spec.md b/profiles/default/workflows/specification/write-spec.md deleted file mode 100644 index ed9d8029..00000000 --- a/profiles/default/workflows/specification/write-spec.md +++ /dev/null @@ -1,99 +0,0 @@ -# Spec Writing - -## Core Responsibilities - -1. **Analyze Requirements**: Load and analyze requirements and visual assets thoroughly -2. **Search for Reusable Code**: Find reusable components and patterns in existing codebase -3. **Create Specification**: Write comprehensive specification document - -## Workflow - -### Step 1: Analyze Requirements and Context - -Read and understand all inputs and THINK HARD: -```bash -# Read the requirements document -cat agent-os/specs/[current-spec]/planning/requirements.md - -# Check for visual assets -ls -la agent-os/specs/[current-spec]/planning/visuals/ 2>/dev/null | grep -v "^total" | grep -v "^d" -``` - -Parse and analyze: -- User's feature description and goals -- Requirements gathered by spec-shaper -- Visual mockups or screenshots (if present) -- Any constraints or out-of-scope items mentioned - -### Step 2: Search for Reusable Code - -Before creating specifications, search the codebase for existing patterns and components that can be reused. - -Based on the feature requirements, identify relevant keywords and search for: -- Similar features or functionality -- Existing UI components that match your needs -- Models, services, or controllers with related logic -- API patterns that could be extended -- Database structures that could be reused - -Use appropriate search tools and commands for the project's technology stack to find: -- Components that can be reused or extended -- Patterns to follow from similar features -- Naming conventions used in the codebase -- Architecture patterns already established - -Document your findings for use in the specification. - -### Step 3: Create Core Specification - -Write the main specification to `agent-os/specs/[current-spec]/spec.md`. - -DO NOT write actual code in the spec.md document. Just describe the requirements clearly and concisely. - -Keep it short and include only essential information for each section. - -Follow this structure exactly when creating the content of `spec.md`: - -```markdown -# Specification: [Feature Name] - -## Goal -[1-2 sentences describing the core objective] - -## User Stories -- As a [user type], I want to [action] so that [benefit] -- [repeat for up to 2 max additional user stories] - -## Specific Requirements - -**Specific requirement name** -- [Up to 8 CONCISE sub-bullet points to clarify specific sub-requirements, design or architectual decisions that go into this requirement, or the technical approach to take when implementing this requirement] - -[repeat for up to a max of 10 specific requirements] - -## Visual Design -[If mockups provided] - -**`planning/visuals/[filename]`** -- [up to 8 CONCISE bullets describing specific UI elements found in this visual to address when building] - -[repeat for each file in the `planning/visuals` folder] - -## Existing Code to Leverage - -**Code, component, or existing logic found** -- [up to 5 bullets that describe what this existing code does and how it should be re-used or replicated when building this spec] - -[repeat for up to 5 existing code areas] - -## Out of Scope -- [up to 10 concise descriptions of specific features that are out of scope and MUST NOT be built in this spec] -``` - -## Important Constraints - -1. **Always search for reusable code** before specifying new components -2. **Reference visual assets** when available -3. **Do NOT write actual code** in the spec -4. **Keep each section short**, with clear, direct, skimmable specifications -5. **Do NOT deviate from the template above** and do not add additional sections diff --git a/scripts/base-install.sh b/scripts/base-install.sh deleted file mode 100755 index d908bce2..00000000 --- a/scripts/base-install.sh +++ /dev/null @@ -1,701 +0,0 @@ -#!/bin/bash - -# Agent OS Base Installation Script -# Installs Agent OS from GitHub repository to ~/agent-os - -set -e - -# Repository configuration -REPO_URL="https://github.com/buildermethods/agent-os" - -# Installation paths -BASE_DIR="$HOME/agent-os" -TEMP_DIR=$(mktemp -d) -COMMON_FUNCTIONS_TEMP="$TEMP_DIR/common-functions.sh" - -# ----------------------------------------------------------------------------- -# Bootstrap Functions (before common-functions.sh is available) -# ----------------------------------------------------------------------------- - -# Minimal color codes for bootstrap -BLUE='\033[0;36m' -RED='\033[0;31m' -YELLOW='\033[1;33m' -NC='\033[0m' - -# Bootstrap print functions -bootstrap_print() { - echo -e "${BLUE}$1${NC}" -} - -bootstrap_error() { - echo -e "${RED}βœ— $1${NC}" -} - -# Download common-functions.sh first -download_common_functions() { - local functions_url="${REPO_URL}/raw/main/scripts/common-functions.sh" - - if curl -sL --fail "$functions_url" -o "$COMMON_FUNCTIONS_TEMP"; then - # Source the common functions - source "$COMMON_FUNCTIONS_TEMP" - return 0 - else - bootstrap_error "Failed to download common-functions.sh" - exit 1 - fi -} - -# ----------------------------------------------------------------------------- -# Initialize common functions -# ----------------------------------------------------------------------------- - -bootstrap_print "Initializing..." -download_common_functions - -# Clean up temp directory on exit and restore cursor -cleanup() { - if [[ -d "$TEMP_DIR" ]]; then - rm -rf "$TEMP_DIR" - fi - # Always restore cursor on exit - tput cnorm 2>/dev/null || true -} -trap cleanup EXIT - -# ----------------------------------------------------------------------------- -# Version Functions -# ----------------------------------------------------------------------------- - -# Get latest version from GitHub -get_latest_version() { - local config_url="${REPO_URL}/raw/main/config.yml" - curl -sL "$config_url" | grep "^version:" | sed 's/version: *//' | tr -d '\r\n' -} - -# ----------------------------------------------------------------------------- -# Download Functions -# ----------------------------------------------------------------------------- - -# Download file from GitHub -download_file() { - local relative_path=$1 - local dest_path=$2 - local file_url="${REPO_URL}/raw/main/${relative_path}" - - mkdir -p "$(dirname "$dest_path")" - - if curl -sL --fail "$file_url" -o "$dest_path"; then - return 0 - else - return 1 - fi -} - -# Define exclusion patterns -EXCLUSIONS=( - "scripts/base-install.sh" - "old-versions/*" - ".git*" - ".github/*" -) - -# Check if a file should be excluded -should_exclude() { - local file_path=$1 - - for pattern in "${EXCLUSIONS[@]}"; do - # Check exact match - if [[ "$file_path" == "$pattern" ]]; then - return 0 - fi - # Check wildcard patterns - if [[ "$pattern" == *"*"* ]]; then - local prefix="${pattern%\*}" - if [[ "$file_path" == "$prefix"* ]]; then - return 0 - fi - fi - done - - return 1 -} - -# Get all files from GitHub repo using the tree API -get_all_repo_files() { - # Get the default branch (usually main or master) - local branch="main" - - # Extract owner and repo name from URL - # From: https://github.com/owner/repo to owner/repo - local repo_path=$(echo "$REPO_URL" | sed 's|^https://github.com/||') - - print_verbose "Repository path: $repo_path" - - # Build API URL - local tree_url="https://api.github.com/repos/${repo_path}/git/trees/${branch}?recursive=true" - - print_verbose "Fetching from: $tree_url" - - local response=$(curl -sL "$tree_url") - - # Check if we got a valid response - if [[ -z "$response" ]]; then - print_verbose "Empty response from GitHub API" - return 1 - fi - - # Debug: Show first 500 chars of response - print_verbose "Response preview: ${response:0:500}" - - if echo "$response" | grep -q '"message"'; then - local error_msg=$(echo "$response" | grep -o '"message":"[^"]*"' | sed 's/"message":"//' | sed 's/"$//') - print_verbose "GitHub API error: $error_msg" - return 1 - fi - - # Check if we have tree data (use grep -c to avoid broken pipe) - if [[ $(echo "$response" | grep -c '"tree"' 2>/dev/null || true) -eq 0 ]]; then - print_verbose "No tree data in response" - return 1 - fi - - # Use jq if available, otherwise use python - if command -v jq &> /dev/null; then - print_verbose "Using jq to parse JSON" - echo "$response" | jq -r '.tree[] | select(.type=="blob") | .path' | while read -r file_path; do - if ! should_exclude "$file_path"; then - echo "$file_path" - fi - done - elif command -v python3 &> /dev/null; then - print_verbose "Using python to parse JSON" - echo "$response" | python3 -c " -import sys, json -data = json.load(sys.stdin) -for item in data.get('tree', []): - if item.get('type') == 'blob': - print(item.get('path', '')) -" | while read -r file_path; do - if [[ -n "$file_path" ]] && ! should_exclude "$file_path"; then - echo "$file_path" - fi - done - else - print_verbose "Using sed/awk to parse JSON (less reliable)" - # Parse JSON using sed and awk - less reliable but works for simple cases - echo "$response" | awk -F'"' '/"type":"blob"/{blob=1} blob && /"path":/{print $4; blob=0}' | while read -r file_path; do - if ! should_exclude "$file_path"; then - echo "$file_path" - fi - done - fi -} - -# Download all files from the repository -download_all_files() { - local dest_base=$1 - local file_count=0 - - print_verbose "Fetching repository file list..." - - # Get list of all files (excluding our exclusion list) - local all_files=$(get_all_repo_files) - - if [[ -z "$all_files" ]]; then - echo "0" # Return 0 to indicate no files downloaded - return 1 - fi - - # Download each file (using process substitution to avoid subshell variable issue) - while IFS= read -r file_path; do - if [[ -n "$file_path" ]]; then - local dest_file="${dest_base}/${file_path}" - - # Create directory if needed - local dir_path=$(dirname "$dest_file") - [[ -d "$dir_path" ]] || mkdir -p "$dir_path" - - if download_file "$file_path" "$dest_file"; then - ((file_count++)) || true - print_verbose " Downloaded: ${file_path}" - else - print_verbose " Failed to download: ${file_path}" - fi - fi - done <<< "$all_files" - - echo "$file_count" -} - -# ----------------------------------------------------------------------------- -# Helper Functions -# ----------------------------------------------------------------------------- - -# Print status message without newline -print_status_no_newline() { - echo -ne "${BLUE}$1${NC}" -} - -# Animated spinner for long-running operations -spinner() { - local delay=0.5 - while true; do - for dot_count in "" "." ".." "..."; do - echo -ne "\r${BLUE}Installing Agent OS files${dot_count}${NC} " - sleep $delay - done - done -} - -# ----------------------------------------------------------------------------- -# Installation Functions -# ----------------------------------------------------------------------------- - -# Install all files from repository -install_all_files() { - if [[ "$DRY_RUN" != "true" ]]; then - # Start spinner in background - spinner_pid="" - if [[ "$VERBOSE" != "true" ]]; then - # Hide cursor before starting spinner - tput civis 2>/dev/null || true - spinner & - spinner_pid=$! - else - print_status "Installing Agent OS files..." - fi - fi - - # Download all files (excluding those in exclusion list) - local file_count - file_count=$(download_all_files "$BASE_DIR") - local download_status=$? - - # Stop spinner if running - if [[ -n "$spinner_pid" ]]; then - kill $spinner_pid 2>/dev/null - wait $spinner_pid 2>/dev/null - # Clear the line and restore cursor - echo -ne "\r\033[K" - tput cnorm 2>/dev/null || true # Show cursor again - fi - - if [[ "$DRY_RUN" != "true" ]]; then - if [[ $download_status -eq 0 && $file_count -gt 0 ]]; then - echo "βœ“ Installed $file_count files to ~/agent-os" - else - print_error "No files were downloaded" - return 1 - fi - fi - - # Make scripts executable - if [[ -d "$BASE_DIR/scripts" ]]; then - chmod +x "$BASE_DIR/scripts/"*.sh 2>/dev/null || true - fi - - return 0 -} - -# ----------------------------------------------------------------------------- -# Overwrite Functions -# ----------------------------------------------------------------------------- - -# Prompt for overwrite choice -prompt_overwrite_choice() { - local current_version=$1 - local latest_version=$2 - - echo "" - echo -e "${YELLOW}=== ⚠️ Existing Installation Detected ===${NC}" - echo "" - - echo "You already have a base installation of Agent OS" - - if [[ -n "$current_version" ]]; then - echo -e " Your installed version: ${YELLOW}$current_version${NC}" - else - echo " Your installed version: (unknown)" - fi - - if [[ -n "$latest_version" ]]; then - echo -e " Latest available version: ${YELLOW}$latest_version${NC}" - else - echo " Latest available version: (unable to determine)" - fi - - echo "" - print_status "What would you like to do?" - echo "" - - echo -e "${YELLOW}1) Full update${NC}" - echo "" - echo " Updates & overwrites:" - echo " - ~/agent-os/profiles/default/*" - echo " - ~/agent-os/scripts/*" - echo " - ~/agent-os/CHANGELOG.md" - echo "" - echo " Updates your version number in ~/agent-os/config.yml but doesn't change anything else in this file." - echo "" - echo " Everything else in your ~/agent-os folder will remain intact." - echo "" - - echo -e "${YELLOW}2) Update default profile only${NC}" - echo "" - echo " Updates & overwrites:" - echo " - ~/agent-os/profiles/default/*" - echo "" - echo " Everything else in your ~/agent-os folder will remain intact." - echo "" - - echo -e "${YELLOW}3) Update scripts only${NC}" - echo "" - echo " Updates & overwrites:" - echo " - ~/agent-os/scripts/*" - echo "" - echo " Everything else in your ~/agent-os folder will remain intact." - echo "" - - echo -e "${YELLOW}4) Update config.yml only${NC}" - echo "" - echo " Updates & overwrites:" - echo " - ~/agent-os/config.yml" - echo "" - echo " Everything else in your ~/agent-os folder will remain intact." - echo "" - - echo -e "${YELLOW}5) Delete & reinstall fresh${NC}" - echo "" - echo " - Makes a backup of your current ~/agent-os folder at ~/agent-os.backup" - echo " - Deletes your current ~/agent-os folder and all of its contents." - echo " - Installs a fresh ~/agent-os base installation" - echo "" - - echo -e "${YELLOW}6) Cancel and abort${NC}" - echo "" - - read -p "Enter your choice (1-6): " choice < /dev/tty - - case $choice in - 1) - echo "" - print_status "Performing full update..." - full_update "$latest_version" - ;; - 2) - echo "" - print_status "Updating default profile..." - create_backup - overwrite_profile - ;; - 3) - echo "" - print_status "Updating scripts..." - create_backup - overwrite_scripts - ;; - 4) - echo "" - print_status "Updating config.yml..." - create_backup - overwrite_config - ;; - 5) - echo "" - print_status "Deleting & reinstalling fresh..." - overwrite_all - ;; - 6) - echo "" - print_warning "Installation cancelled" - exit 0 - ;; - *) - print_error "Invalid choice. Installation cancelled." - exit 1 - ;; - esac -} - -# Create backup of existing installation -create_backup() { - # Backup existing installation - if [[ -d "$BASE_DIR.backup" ]]; then - rm -rf "$BASE_DIR.backup" - fi - cp -R "$BASE_DIR" "$BASE_DIR.backup" - echo "βœ“ Backed up existing installation to ~/agent-os.backup" - echo "" -} - -# Full update - updates profile, scripts, CHANGELOG.md, and version number in config.yml -full_update() { - local latest_version=$1 - - # Create backup first - create_backup - - # Update default profile - print_status "Updating default profile..." - rm -rf "$BASE_DIR/profiles/default" - local file_count=0 - local all_files=$(get_all_repo_files | grep "^profiles/default/") - if [[ -n "$all_files" ]]; then - while IFS= read -r file_path; do - if [[ -n "$file_path" ]]; then - local dest_file="${BASE_DIR}/${file_path}" - local dir_path=$(dirname "$dest_file") - [[ -d "$dir_path" ]] || mkdir -p "$dir_path" - if download_file "$file_path" "$dest_file"; then - ((file_count++)) || true - print_verbose " Downloaded: ${file_path}" - fi - fi - done <<< "$all_files" - fi - echo "βœ“ Updated default profile ($file_count files)" - echo "" - - # Update scripts - print_status "Updating scripts..." - rm -rf "$BASE_DIR/scripts" - file_count=0 - all_files=$(get_all_repo_files | grep "^scripts/") - if [[ -n "$all_files" ]]; then - while IFS= read -r file_path; do - if [[ -n "$file_path" ]]; then - local dest_file="${BASE_DIR}/${file_path}" - local dir_path=$(dirname "$dest_file") - [[ -d "$dir_path" ]] || mkdir -p "$dir_path" - if download_file "$file_path" "$dest_file"; then - ((file_count++)) || true - print_verbose " Downloaded: ${file_path}" - fi - fi - done <<< "$all_files" - chmod +x "$BASE_DIR/scripts/"*.sh 2>/dev/null || true - fi - echo "βœ“ Updated scripts ($file_count files)" - echo "" - - # Update CHANGELOG.md - print_status "Updating CHANGELOG.md..." - if download_file "CHANGELOG.md" "$BASE_DIR/CHANGELOG.md"; then - echo "βœ“ Updated CHANGELOG.md" - fi - echo "" - - # Update version number in config.yml (without overwriting the entire file) - print_status "Updating version number in config.yml..." - if [[ -f "$BASE_DIR/config.yml" ]] && [[ -n "$latest_version" ]]; then - # Use sed to update only the version line - sed -i.bak "s/^version:.*/version: $latest_version/" "$BASE_DIR/config.yml" - rm -f "$BASE_DIR/config.yml.bak" - echo "βœ“ Updated version to $latest_version in config.yml" - fi - echo "" - - print_success "Full update completed!" -} - -# Overwrite everything -overwrite_all() { - # Backup existing installation - if [[ -d "$BASE_DIR.backup" ]]; then - rm -rf "$BASE_DIR.backup" - fi - mv "$BASE_DIR" "$BASE_DIR.backup" - echo "βœ“ Backed up existing installation to ~/agent-os.backup" - echo "" - - # Perform fresh installation - perform_fresh_installation -} - -# Overwrite only profile -overwrite_profile() { - # Remove existing default profile - rm -rf "$BASE_DIR/profiles/default" - - # Download only profile files - local file_count=0 - - # Get all files and filter for profiles/default - local all_files=$(get_all_repo_files | grep "^profiles/default/") - - if [[ -n "$all_files" ]]; then - while IFS= read -r file_path; do - if [[ -n "$file_path" ]]; then - local dest_file="${BASE_DIR}/${file_path}" - local dir_path=$(dirname "$dest_file") - [[ -d "$dir_path" ]] || mkdir -p "$dir_path" - - if download_file "$file_path" "$dest_file"; then - ((file_count++)) || true - print_verbose " Downloaded: ${file_path}" - fi - fi - done <<< "$all_files" - fi - - echo "βœ“ Updated default profile ($file_count files)" - echo "" - print_success "Default profile has been updated!" -} - -# Overwrite only scripts -overwrite_scripts() { - # Remove existing scripts - rm -rf "$BASE_DIR/scripts" - - # Download only script files - local file_count=0 - - # Get all files and filter for scripts/ - local all_files=$(get_all_repo_files | grep "^scripts/") - - if [[ -n "$all_files" ]]; then - while IFS= read -r file_path; do - if [[ -n "$file_path" ]]; then - local dest_file="${BASE_DIR}/${file_path}" - local dir_path=$(dirname "$dest_file") - [[ -d "$dir_path" ]] || mkdir -p "$dir_path" - - if download_file "$file_path" "$dest_file"; then - ((file_count++)) || true - print_verbose " Downloaded: ${file_path}" - fi - fi - done <<< "$all_files" - - # Make scripts executable - chmod +x "$BASE_DIR/scripts/"*.sh 2>/dev/null || true - fi - - echo "βœ“ Updated scripts ($file_count files)" - echo "" - print_success "Scripts have been updated!" -} - -# Overwrite only config -overwrite_config() { - # Download new config.yml - if download_file "config.yml" "$BASE_DIR/config.yml"; then - print_verbose " Downloaded: config.yml" - fi - - echo "βœ“ Updated config.yml" - echo "" - print_success "Config has been updated!" -} - -# ----------------------------------------------------------------------------- -# Main Installation Functions -# ----------------------------------------------------------------------------- - -# Perform fresh installation -perform_fresh_installation() { - echo "" - print_status "Configuration:" - echo -e " Repository: ${YELLOW}${REPO_URL}${NC}" - echo -e " Target: ${YELLOW}~/agent-os${NC}" - echo "" - - # Create base directory - ensure_dir "$BASE_DIR" - echo "βœ“ Created base directory: ~/agent-os" - echo "" - - # Install all files from repository - if ! install_all_files; then - print_error "Installation failed" - exit 1 - fi - - echo "" - print_success "Agent OS has been successfully installed!" - echo "" - echo -e "${GREEN}Next steps:${NC}" - echo "" - echo -e "${GREEN}1) Customize your profile's standards in ~/agent-os/profiles/default/standards${NC}" - echo "" - echo -e "${GREEN}2) Navigate to a project directory${NC}" - echo -e " ${YELLOW}cd path/to/project-directory${NC}" - echo "" - echo -e "${GREEN}3) Install Agent OS in your project by running:${NC}" - echo -e " ${YELLOW}~/agent-os/scripts/project-install.sh${NC}" - echo "" - echo -e "${GREEN}Visit the docs for guides on how to use Agent OS: https://buildermethods.com/agent-os${NC}" - echo "" -} - -# Check for existing installation -check_existing_installation() { - if [[ -d "$BASE_DIR" ]]; then - # Get current version if available - local current_version="" - if [[ -f "$BASE_DIR/config.yml" ]]; then - current_version=$(get_yaml_value "$BASE_DIR/config.yml" "version" "") - fi - - # Get latest version from GitHub - local latest_version=$(get_latest_version) - - # Prompt for overwrite choice - prompt_overwrite_choice "$current_version" "$latest_version" - else - # Fresh installation - perform_fresh_installation - fi -} - -# ----------------------------------------------------------------------------- -# Global Variables -# ----------------------------------------------------------------------------- - -VERBOSE=false -DRY_RUN=false - -# ----------------------------------------------------------------------------- -# Main Execution -# ----------------------------------------------------------------------------- - -main() { - print_section "Agent OS Base Installation" - - # Parse command line arguments - while [[ $# -gt 0 ]]; do - case $1 in - -v|--verbose) - VERBOSE=true - shift - ;; - -h|--help) - echo "Usage: $0 [OPTIONS]" - echo "" - echo "Options:" - echo " -v, --verbose Show verbose output" - echo " -h, --help Show this help message" - exit 0 - ;; - *) - print_error "Unknown option: $1" - echo "Use -h or --help for usage information" - exit 1 - ;; - esac - done - - # Check for curl - if ! command -v curl &> /dev/null; then - print_error "curl is required but not installed. Please install curl and try again." - exit 1 - fi - - # Check for existing installation or perform fresh install - check_existing_installation -} - -# Run main function -main "$@" diff --git a/scripts/common-functions.sh b/scripts/common-functions.sh index 3474bfc0..d04a63df 100755 --- a/scripts/common-functions.sh +++ b/scripts/common-functions.sh @@ -13,12 +13,6 @@ BLUE='\033[38;2;0;208;255m' PURPLE='\033[38;2;142;81;255m' NC='\033[0m' # No Color -# ----------------------------------------------------------------------------- -# Global Variables (set by scripts that source this file) -# ----------------------------------------------------------------------------- -# These should be set by the calling script: -# BASE_DIR, PROJECT_DIR, DRY_RUN, VERBOSE - # ----------------------------------------------------------------------------- # Output Functions # ----------------------------------------------------------------------------- @@ -65,34 +59,10 @@ print_verbose() { } # ----------------------------------------------------------------------------- -# String Normalization Functions -# ----------------------------------------------------------------------------- - -# Normalize input to lowercase, replace spaces/underscores with hyphens, remove punctuation -normalize_name() { - local input=$1 - echo "$input" | tr '[:upper:]' '[:lower:]' | sed 's/[ _]/-/g' | sed 's/[^a-z0-9-]//g' -} - -# ----------------------------------------------------------------------------- -# Improved YAML Parsing Functions (More Robust) +# YAML Parsing (Simple) # ----------------------------------------------------------------------------- -# Normalize YAML line (handle tabs, trim spaces, etc.) -normalize_yaml_line() { - echo "$1" | sed 's/\t/ /g' | sed 's/[[:space:]]*$//' -} - -# Get indentation level (counts spaces/tabs at beginning) -get_indent_level() { - local line="$1" - local normalized=$(echo "$line" | sed 's/\t/ /g') - local spaces=$(echo "$normalized" | sed 's/[^ ].*//') - echo "${#spaces}" -} - -# Get a simple value from YAML (handles key: value format) -# More robust: handles quotes, different spacing, tabs +# Get a simple value from YAML (key: value format) get_yaml_value() { local file=$1 local key=$2 @@ -103,1366 +73,154 @@ get_yaml_value() { return fi - # Look for the key with flexible spacing and handle quotes - local value=$(awk -v key="$key" ' - BEGIN { found=0 } - { - # Normalize tabs to spaces - gsub(/\t/, " ") - # Remove leading/trailing spaces - gsub(/^[[:space:]]+/, "") - gsub(/[[:space:]]+$/, "") - } - # Match key: value (with or without spaces around colon) - $0 ~ "^" key "[[:space:]]*:" { - # Extract value after colon - sub("^" key "[[:space:]]*:[[:space:]]*", "") - # Remove quotes if present - gsub(/^["'\'']/, "") - gsub(/["'\'']$/, "") - # Handle empty value - if (length($0) > 0) { - print $0 - found=1 - exit - } - } - END { if (!found) exit 1 } - ' "$file" 2>/dev/null) + local value=$(grep "^${key}:" "$file" | sed "s/^${key}:[[:space:]]*//" | sed 's/[[:space:]]*$//') - if [[ $? -eq 0 && -n "$value" ]]; then + if [[ -n "$value" ]]; then echo "$value" else echo "$default" fi } -# Get array values from YAML (handles - item format under a key) -# More robust: handles variable indentation -get_yaml_array() { - local file=$1 - local key=$2 +# Get inherits_from value for a profile from config.yml +# Returns empty string if profile has no inheritance defined +get_profile_inherits_from() { + local config_file=$1 + local profile_name=$2 - if [[ ! -f "$file" ]]; then + if [[ ! -f "$config_file" ]]; then + echo "" return fi - awk -v key="$key" ' - BEGIN { - found=0 - key_indent=-1 - array_indent=-1 - } - { - # Normalize tabs to spaces - gsub(/\t/, " ") - - # Get current line indentation - indent = match($0, /[^ ]/) - if (indent == 0) indent = length($0) + 1 - indent = indent - 1 - - # Store original line for processing - line = $0 - # Remove leading spaces for pattern matching - gsub(/^[[:space:]]+/, "") - } - - # Found the key - !found && $0 ~ "^" key "[[:space:]]*:" { - found = 1 - key_indent = indent - next - } - - # Process array items under the key - found { - # If we hit a line with same or less indentation as key, stop - if (indent <= key_indent && $0 != "" && $0 !~ /^[[:space:]]*$/) { - exit - } - - # Look for array items (- item) - if ($0 ~ /^-[[:space:]]/) { - # Set array indent from first item - if (array_indent == -1) { - array_indent = indent - } - - # Only process items at the expected indentation - if (indent == array_indent) { - sub(/^-[[:space:]]*/, "") - # Remove quotes if present - gsub(/^["'\'']/, "") - gsub(/["'\'']$/, "") - print - } - } + # Use awk to find the inherits_from value for the given profile + # Format: + # profiles: + # profile-name: + # inherits_from: parent-profile + local value=$(awk -v profile="$profile_name" ' + /^profiles:/ { in_profiles=1; next } + /^[a-zA-Z]/ && !/^[[:space:]]/ { in_profiles=0 } + in_profiles && $0 ~ "^ "profile":$" { in_target=1; next } + in_profiles && in_target && /^ [a-zA-Z0-9_-]+:$/ { in_target=0 } + in_profiles && in_target && /inherits_from:/ { + sub(/^[[:space:]]*inherits_from:[[:space:]]*/, "") + gsub(/[[:space:]]*$/, "") + print + exit } - ' "$file" -} - -# ----------------------------------------------------------------------------- -# File Operations Functions -# ----------------------------------------------------------------------------- - -# Create directory if it doesn't exist (unless in dry-run mode) -ensure_dir() { - local dir=$1 - - if [[ "$DRY_RUN" == "true" ]]; then - if [[ ! -d "$dir" ]]; then - print_verbose "Would create directory: $dir" - fi - else - if [[ ! -d "$dir" ]]; then - mkdir -p "$dir" - print_verbose "Created directory: $dir" - fi - fi -} - -# Copy file with dry-run support -copy_file() { - local source=$1 - local dest=$2 - - if [[ "$DRY_RUN" == "true" ]]; then - echo "$dest" - else - ensure_dir "$(dirname "$dest")" - cp "$source" "$dest" - print_verbose "Copied: $source -> $dest" - echo "$dest" - fi -} - -# Write content to file with dry-run support -write_file() { - local content=$1 - local dest=$2 - - if [[ "$DRY_RUN" == "true" ]]; then - echo "$dest" - else - ensure_dir "$(dirname "$dest")" - echo "$content" > "$dest" - print_verbose "Wrote file: $dest" - fi -} - -# Check if file should be skipped during update -should_skip_file() { - local file=$1 - local overwrite_all=$2 - local overwrite_type=$3 - local file_type=$4 - - if [[ "$overwrite_all" == "true" ]]; then - return 1 # Don't skip - fi - - if [[ ! -f "$file" ]]; then - return 1 # Don't skip - file doesn't exist - fi - - # Check specific overwrite flags - case "$file_type" in - "agent") - [[ "$overwrite_type" == "true" ]] && return 1 - ;; - "command") - [[ "$overwrite_type" == "true" ]] && return 1 - ;; - "standard") - [[ "$overwrite_type" == "true" ]] && return 1 - ;; - esac - - return 0 # Skip file -} - -# ----------------------------------------------------------------------------- -# Profile Functions -# ----------------------------------------------------------------------------- - -# Get the effective profile path considering inheritance -get_profile_file() { - local profile=$1 - local file_path=$2 - local base_dir=$3 - - local current_profile=$profile - local visited_profiles="" - - while true; do - # Check for circular inheritance - if [[ " $visited_profiles " == *" $current_profile "* ]]; then - print_verbose "Circular inheritance detected at profile: $current_profile" - echo "" - return - fi - visited_profiles="$visited_profiles $current_profile" - - local profile_dir="$base_dir/profiles/$current_profile" - local full_path="$profile_dir/$file_path" - - # Check for profile config first (needed for exclusion check) - local profile_config="$profile_dir/profile-config.yml" - - # Check if file exists in current profile - if [[ -f "$full_path" ]]; then - # Check if this file is excluded (even in current profile) - if [[ -f "$profile_config" ]]; then - local excluded="false" - while read pattern; do - if [[ -n "$pattern" ]] && match_pattern "$file_path" "$pattern"; then - excluded="true" - break - fi - done < <(get_yaml_array "$profile_config" "exclude_inherited_files") - - if [[ "$excluded" == "true" ]]; then - echo "" - return + ' "$config_file") + + echo "$value" +} + +# Build the profile inheritance chain (from base to requested profile) +# Returns newline-separated list of profiles, base first +# Exits with error if circular dependency detected +get_profile_inheritance_chain() { + local config_file=$1 + local profile_name=$2 + local profiles_dir=$3 + + local chain="" + local visited="" + local current="$profile_name" + + # Build chain by following inherits_from links + while [[ -n "$current" ]]; do + # Check for circular dependency + if echo "$visited" | grep -q "^${current}$"; then + # Build the cycle path for error message + local cycle_path="$current" + local trace="$profile_name" + while [[ "$trace" != "$current" ]] || [[ -z "$cycle_path" || "$cycle_path" == "$current" ]]; do + local parent=$(get_profile_inherits_from "$config_file" "$trace") + if [[ "$trace" == "$profile_name" ]]; then + cycle_path="$trace" + else + cycle_path="$cycle_path β†’ $trace" fi - fi - echo "$full_path" - return - fi - - # Check for inheritance - if [[ ! -f "$profile_config" ]]; then - # No profile config means this is likely the default profile - echo "" - return - fi - - local inherits_from=$(get_yaml_value "$profile_config" "inherits_from" "default") - - if [[ "$inherits_from" == "false" || -z "$inherits_from" ]]; then - echo "" - return - fi - - # Check if file is excluded during inheritance - local excluded="false" - while read pattern; do - if [[ -n "$pattern" ]] && match_pattern "$file_path" "$pattern"; then - excluded="true" - break - fi - done < <(get_yaml_array "$profile_config" "exclude_inherited_files") - - if [[ "$excluded" == "true" ]]; then - echo "" - return - fi - - current_profile=$inherits_from - done -} - -# Get all files from profile considering inheritance -get_profile_files() { - local profile=$1 - local base_dir=$2 - local subdir=$3 - - local current_profile=$profile - local visited_profiles="" - local all_files="" - local excluded_patterns="" - - # First, collect exclusion patterns and file overrides - while true; do - if [[ " $visited_profiles " == *" $current_profile "* ]]; then - break - fi - visited_profiles="$visited_profiles $current_profile" - - local profile_dir="$base_dir/profiles/$current_profile" - local profile_config="$profile_dir/profile-config.yml" - - # Add exclusion patterns from this profile - if [[ -f "$profile_config" ]]; then - local patterns=$(get_yaml_array "$profile_config" "exclude_inherited_files") - if [[ -n "$patterns" ]]; then - excluded_patterns="$excluded_patterns"$'\n'"$patterns" - fi - - local inherits_from=$(get_yaml_value "$profile_config" "inherits_from" "default") - if [[ "$inherits_from" == "false" || -z "$inherits_from" ]]; then - break - fi - current_profile=$inherits_from - else - break - fi - done - - # Now collect files starting from the base profile - local profiles_to_process="" - current_profile=$profile - visited_profiles="" - - while true; do - if [[ " $visited_profiles " == *" $current_profile "* ]]; then - break - fi - visited_profiles="$visited_profiles $current_profile" - profiles_to_process="$current_profile $profiles_to_process" - - local profile_dir="$base_dir/profiles/$current_profile" - local profile_config="$profile_dir/profile-config.yml" - - if [[ -f "$profile_config" ]]; then - local inherits_from=$(get_yaml_value "$profile_config" "inherits_from" "default") - if [[ "$inherits_from" == "false" || -z "$inherits_from" ]]; then - break - fi - current_profile=$inherits_from - else - break - fi - done - - # Process profiles from base to specific - for proc_profile in $profiles_to_process; do - local profile_dir="$base_dir/profiles/$proc_profile" - local search_dir="$profile_dir" - - if [[ -n "$subdir" ]]; then - search_dir="$profile_dir/$subdir" - fi - - if [[ -d "$search_dir" ]]; then - find "$search_dir" -type f \( -name "*.md" -o -name "*.yml" -o -name "*.yaml" \) 2>/dev/null | while read file; do - relative_path="${file#$profile_dir/}" - - # Check if excluded - excluded="false" - while read pattern; do - if [[ -n "$pattern" ]] && match_pattern "$relative_path" "$pattern"; then - excluded="true" - break - fi - done <<< "$excluded_patterns" - - if [[ "$excluded" != "true" ]]; then - # Check if already in list (override scenario) - if [[ ! " $all_files " == *" $relative_path "* ]]; then - echo "$relative_path" - fi + if [[ "$parent" == "$current" ]]; then + cycle_path="$cycle_path β†’ $current" + break fi + trace="$parent" done - fi - done | sort -u -} - -# Match file path against pattern (supports wildcards) -match_pattern() { - local path=$1 - local pattern=$2 - - # Convert pattern to regex - local regex=$(echo "$pattern" | sed 's/\*/[^\/]*/g' | sed 's/\*\*/.**/g') - - if [[ "$path" =~ ^${regex}$ ]]; then - return 0 - else - return 1 - fi -} - -# ----------------------------------------------------------------------------- -# Template Processing Functions -# ----------------------------------------------------------------------------- - -# Replace Playwright tool with expanded tool list -replace_playwright_tools() { - local tools=$1 - - local playwright_tools="mcp__playwright__browser_close, mcp__playwright__browser_console_messages, mcp__playwright__browser_handle_dialog, mcp__playwright__browser_evaluate, mcp__playwright__browser_file_upload, mcp__playwright__browser_fill_form, mcp__playwright__browser_install, mcp__playwright__browser_press_key, mcp__playwright__browser_type, mcp__playwright__browser_navigate, mcp__playwright__browser_navigate_back, mcp__playwright__browser_network_requests, mcp__playwright__browser_take_screenshot, mcp__playwright__browser_snapshot, mcp__playwright__browser_click, mcp__playwright__browser_drag, mcp__playwright__browser_hover, mcp__playwright__browser_select_option, mcp__playwright__browser_tabs, mcp__playwright__browser_wait_for, mcp__ide__getDiagnostics, mcp__ide__executeCode, mcp__playwright__browser_resize" - - echo "$tools" | sed "s/Playwright/$playwright_tools/g" -} - -# Process conditional compilation tags ({{IF}}, {{UNLESS}}, {{ENDIF}}, {{ENDUNLESS}}) -# Ignores {{orchestrated_standards}} and other placeholders -process_conditionals() { - local content=$1 - local use_claude_code_subagents=$2 - local standards_as_claude_code_skills=$3 - local compiled_single_command=${4:-"false"} # Default to false if not provided - - local result="" - local nesting_level=0 - local should_include=true - local stack_should_include=() - - while IFS= read -r line; do - # Check for IF tags - if [[ "$line" =~ \{\{IF[[:space:]]+([a-z_]+)\}\} ]]; then - local flag_name="${BASH_REMATCH[1]}" - - # Evaluate condition - local condition_met=false - case "$flag_name" in - "use_claude_code_subagents") - [[ "$use_claude_code_subagents" == "true" ]] && condition_met=true - ;; - "standards_as_claude_code_skills") - [[ "$standards_as_claude_code_skills" == "true" ]] && condition_met=true - ;; - "compiled_single_command") - [[ "$compiled_single_command" == "true" ]] && condition_met=true - ;; - *) - print_warning "Unknown conditional flag: $flag_name" - ;; - esac - - # Push current should_include onto stack - stack_should_include+=("$should_include") - - # Update should_include based on parent's state AND current condition - if [[ "$should_include" == true ]] && [[ "$condition_met" == true ]]; then - should_include=true - else - should_include=false - fi - - ((nesting_level++)) || true - continue - fi - - # Check for UNLESS tags - if [[ "$line" =~ \{\{UNLESS[[:space:]]+([a-z_]+)\}\} ]]; then - local flag_name="${BASH_REMATCH[1]}" - - # Evaluate condition (opposite of IF) - local condition_met=false - case "$flag_name" in - "use_claude_code_subagents") - [[ "$use_claude_code_subagents" != "true" ]] && condition_met=true - ;; - "standards_as_claude_code_skills") - [[ "$standards_as_claude_code_skills" != "true" ]] && condition_met=true - ;; - "compiled_single_command") - [[ "$compiled_single_command" != "true" ]] && condition_met=true - ;; - *) - print_warning "Unknown conditional flag: $flag_name" - ;; - esac - - # Push current should_include onto stack - stack_should_include+=("$should_include") - - # Update should_include based on parent's state AND current condition - if [[ "$should_include" == true ]] && [[ "$condition_met" == true ]]; then - should_include=true - else - should_include=false - fi - - ((nesting_level++)) || true - continue - fi - - # Check for ENDIF tags - if [[ "$line" =~ \{\{ENDIF[[:space:]]+([a-z_]+)\}\} ]]; then - ((nesting_level--)) - - # Pop should_include from stack - if [[ ${#stack_should_include[@]} -gt 0 ]]; then - local last_index=$((${#stack_should_include[@]} - 1)) - should_include="${stack_should_include[$last_index]}" - unset 'stack_should_include[$last_index]' - else - should_include=true - fi - - continue + echo "CIRCULAR:$cycle_path" + return 1 fi - # Check for ENDUNLESS tags - if [[ "$line" =~ \{\{ENDUNLESS[[:space:]]+([a-z_]+)\}\} ]]; then - ((nesting_level--)) - - # Pop should_include from stack - if [[ ${#stack_should_include[@]} -gt 0 ]]; then - local last_index=$((${#stack_should_include[@]} - 1)) - should_include="${stack_should_include[$last_index]}" - unset 'stack_should_include[$last_index]' - else - should_include=true - fi - - continue - fi - - # Include line if should_include is true - if [[ "$should_include" == true ]]; then - if [[ -z "$result" ]]; then - result="$line" - else - result="$result"$'\n'"$line" - fi - fi - done <<< "$content" - - # Check for unclosed conditionals - if [[ $nesting_level -ne 0 ]]; then - print_warning "Unclosed conditional block detected (nesting level: $nesting_level)" - fi - - echo "$result" -} - -# Process workflow replacements recursively -process_workflows() { - local content=$1 - local base_dir=$2 - local profile=$3 - local processed_files=$4 - - # Process each workflow reference - local workflow_refs=$(echo "$content" | grep -o '{{workflows/[^}]*}}' | sort -u) - - while IFS= read -r workflow_ref; do - if [[ -z "$workflow_ref" ]]; then - continue + # Check that profile directory exists + if [[ ! -d "$profiles_dir/$current" ]]; then + echo "NOTFOUND:$current" + return 1 fi - local workflow_path=$(echo "$workflow_ref" | sed 's/{{workflows\///' | sed 's/}}//') - - # Avoid infinite recursion - if [[ " $processed_files " == *" $workflow_path "* ]]; then - print_warning "Circular workflow reference detected: $workflow_path" - continue - fi - - # Get workflow file - local workflow_file=$(get_profile_file "$profile" "workflows/${workflow_path}.md" "$base_dir") - - if [[ -f "$workflow_file" ]]; then - local workflow_content=$(cat "$workflow_file") - - # Recursively process nested workflows - workflow_content=$(process_workflows "$workflow_content" "$base_dir" "$profile" "$processed_files $workflow_path") - - # Create temp files for safe replacement - local temp_content=$(mktemp) - local temp_replacement=$(mktemp) - echo "$content" > "$temp_content" - echo "$workflow_content" > "$temp_replacement" - - # Use perl to do the replacement without escaping newlines - content=$(perl -e ' - use strict; - use warnings; - - my $ref = $ARGV[0]; - my $replacement_file = $ARGV[1]; - my $content_file = $ARGV[2]; - - # Read replacement content - open(my $fh, "<", $replacement_file) or die $!; - my $replacement = do { local $/; <$fh> }; - close($fh); - - # Read main content - open($fh, "<", $content_file) or die $!; - my $content = do { local $/; <$fh> }; - close($fh); - - # Do the replacement - use quotemeta on entire reference - my $pattern = quotemeta($ref); - $content =~ s/$pattern/$replacement/g; - - print $content; - ' "$workflow_ref" "$temp_replacement" "$temp_content") - - rm -f "$temp_content" "$temp_replacement" + # Add to visited list + if [[ -n "$visited" ]]; then + visited="$visited"$'\n'"$current" else - # Instead of printing warning to stderr, insert it into the content - local warning_msg="⚠️ This workflow file was not found in your Agent OS base installation at ~/agent-os/profiles/$profile/workflows/${workflow_path}.md" - # Use perl for safer replacement with special characters - local temp_content=$(mktemp) - echo "$content" > "$temp_content" - content=$(perl -pe "s|\Q$workflow_ref\E|$workflow_ref\n$warning_msg|g" "$temp_content") - rm -f "$temp_content" - fi - done <<< "$workflow_refs" - - echo "$content" -} - -# Process standards replacements -process_standards() { - local content=$1 - local base_dir=$2 - local profile=$3 - local standards_patterns=$4 - - local standards_list="" - - echo "$standards_patterns" | while read pattern; do - if [[ -z "$pattern" ]]; then - continue + visited="$current" fi - local base_path=$(echo "$pattern" | sed 's/\*//') - - if [[ "$pattern" == *"*"* ]]; then - # Wildcard pattern - find all files - local search_dir="standards/$base_path" - get_profile_files "$profile" "$base_dir" "$search_dir" | while read file; do - if [[ "$file" == standards/* ]] && [[ "$file" == *.md ]]; then - echo "@agent-os/$file" - fi - done + # Add to chain (prepend so base ends up first) + if [[ -n "$chain" ]]; then + chain="$current"$'\n'"$chain" else - # Specific file - local file_path="standards/${pattern}.md" - local full_file=$(get_profile_file "$profile" "$file_path" "$base_dir") - if [[ -f "$full_file" ]]; then - echo "@agent-os/$file_path" - fi - fi - done | sort -u -} - -# Process PHASE tag replacements in command files -# Embeds the content of referenced files with H1 headers -process_phase_tags() { - local content=$1 - local base_dir=$2 - local profile=$3 - local mode=$4 # "embed" or empty (no processing) - - # If no mode specified, return content unchanged - if [[ -z "$mode" ]]; then - echo "$content" - return 0 - fi - - # Find all PHASE tags: {{PHASE X: @agent-os/commands/path/to/file.md}} - local phase_refs=$(echo "$content" | grep -o '{{PHASE [^}]*}}' | sort -u) - - if [[ -z "$phase_refs" ]]; then - echo "$content" - return 0 - fi - - while IFS= read -r phase_ref; do - if [[ -z "$phase_ref" ]]; then - continue + chain="$current" fi - if [[ "$mode" == "embed" ]]; then - # CASE A: Embed the file content with H1 header - # Extract: {{PHASE 1: @agent-os/commands/plan-product/1-product-concept.md}} - # To get: PHASE 1, plan-product/1-product-concept.md, "Product Concept" - - local phase_label=$(echo "$phase_ref" | sed 's/{{//' | sed 's/:.*$//') # "PHASE 1" - local file_ref=$(echo "$phase_ref" | sed 's/.*@agent-os\/commands\///' | sed 's/}}$//') # "plan-product/1-product-concept.md" - local file_name=$(basename "$file_ref" .md) # "1-product-concept" - - # Convert "1-product-concept" to "Product Concept" - local title=$(echo "$file_name" | sed 's/^[0-9]*-//' | sed 's/-/ /g' | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2));}1') - - # Get the actual file path in the profile - # Insert /single-agent/ into the path: create-tasks/1-file.md -> create-tasks/single-agent/1-file.md - local cmd_name=$(dirname "$file_ref") - local filename=$(basename "$file_ref") - local source_file=$(get_profile_file "$profile" "commands/$cmd_name/single-agent/$filename" "$base_dir") - - if [[ -f "$source_file" ]]; then - # Read the file content - local file_content=$(cat "$source_file") - - # Process the file content through the compilation pipeline - # (conditionals, workflows, standards) before embedding - # Set compiled_single_command=true to exclude content wrapped in {{UNLESS compiled_single_command}} - file_content=$(process_conditionals "$file_content" "${EFFECTIVE_USE_CLAUDE_CODE_SUBAGENTS:-true}" "${EFFECTIVE_STANDARDS_AS_CLAUDE_CODE_SKILLS:-true}" "true") - file_content=$(process_workflows "$file_content" "$base_dir" "$profile" "") - - # Process standards replacements in the embedded file - local standards_refs=$(echo "$file_content" | grep -o '{{standards/[^}]*}}' | sort -u) - while IFS= read -r standards_ref; do - if [[ -z "$standards_ref" ]]; then - continue - fi - - local standards_pattern=$(echo "$standards_ref" | sed 's/{{standards\///' | sed 's/}}//') - local standards_list=$(process_standards "$file_content" "$base_dir" "$profile" "$standards_pattern") - - # Create temp files for the replacement - local temp_file_content=$(mktemp) - local temp_standards=$(mktemp) - echo "$file_content" > "$temp_file_content" - echo "$standards_list" > "$temp_standards" - - # Use perl to replace without escaping newlines - file_content=$(perl -e ' - use strict; - use warnings; - - my $ref = $ARGV[0]; - my $standards_file = $ARGV[1]; - my $content_file = $ARGV[2]; - - # Read standards list - open(my $fh, "<", $standards_file) or die $!; - my $standards = do { local $/; <$fh> }; - close($fh); - chomp $standards; - - # Read content - open($fh, "<", $content_file) or die $!; - my $content = do { local $/; <$fh> }; - close($fh); - - # Do the replacement - use quotemeta on entire reference - my $pattern = quotemeta($ref); - $content =~ s/$pattern/$standards/g; - - print $content; - ' "$standards_ref" "$temp_standards" "$temp_file_content") - - rm -f "$temp_file_content" "$temp_standards" - done <<< "$standards_refs" - - # Create the replacement text with H1 header - local replacement="# $phase_label: $title"$'\n\n'"$file_content" - - # Replace the tag with the embedded content - local temp_content=$(mktemp) - local temp_replacement=$(mktemp) - echo "$content" > "$temp_content" - echo "$replacement" > "$temp_replacement" - - content=$(perl -e ' - use strict; - use warnings; - - my $ref = $ARGV[0]; - my $replacement_file = $ARGV[1]; - my $content_file = $ARGV[2]; - - # Read replacement - open(my $fh, "<", $replacement_file) or die $!; - my $replacement = do { local $/; <$fh> }; - close($fh); - chomp $replacement; - - # Read content - open($fh, "<", $content_file) or die $!; - my $content = do { local $/; <$fh> }; - close($fh); - - # Do the replacement - use quotemeta on the tag - my $pattern = quotemeta($ref); - $content =~ s/$pattern/$replacement/g; - - print $content; - ' "$phase_ref" "$temp_replacement" "$temp_content") - - rm -f "$temp_content" "$temp_replacement" - else - print_verbose "Warning: File not found for PHASE tag: $file_ref" - fi - fi - - done <<< "$phase_refs" - - echo "$content" -} - -# Compile agent file with all replacements -compile_agent() { - local source_file=$1 - local dest_file=$2 - local base_dir=$3 - local profile=$4 - local role_data=$5 - local phase_mode=${6:-""} # Optional: "embed" to embed PHASE content, or empty for no processing - - local content=$(cat "$source_file") - - # Process role replacements if provided - if [[ -n "$role_data" ]]; then - # Process each role replacement using delimiter-based format - local temp_role_data=$(mktemp) - echo "$role_data" > "$temp_role_data" - - # Parse the delimiter-based format - while IFS= read -r line; do - if [[ "$line" =~ ^'<<<'(.+)'>>>'$ ]]; then - local key="${BASH_REMATCH[1]}" - local value="" - - # Read until we hit <<>> - while IFS= read -r value_line; do - if [[ "$value_line" == "<<>>" ]]; then - break - fi - if [[ -n "$value" ]]; then - value="${value}"$'\n'"${value_line}" - else - value="${value_line}" - fi - done - - if [[ -n "$key" ]]; then - # Create temp files for the replacement - local temp_content=$(mktemp) - local temp_value=$(mktemp) - echo "$content" > "$temp_content" - echo "$value" > "$temp_value" - - # Use perl to replace without escaping newlines - content=$(perl -e ' - use strict; - use warnings; - - my $key = $ARGV[0]; - my $value_file = $ARGV[1]; - my $content_file = $ARGV[2]; - - # Read value - open(my $fh, "<", $value_file) or die $!; - my $value = do { local $/; <$fh> }; - close($fh); - chomp $value; - - # Read content - open($fh, "<", $content_file) or die $!; - my $content = do { local $/; <$fh> }; - close($fh); - - # Do the replacement - use quotemeta on entire pattern (no role. prefix) - my $pattern = quotemeta("{{" . $key . "}}"); - $content =~ s/$pattern/$value/g; - - print $content; - ' "$key" "$temp_value" "$temp_content") - - rm -f "$temp_content" "$temp_value" - fi - fi - done < "$temp_role_data" - - rm -f "$temp_role_data" - fi - - # Process conditional compilation tags - # Uses global variables: EFFECTIVE_USE_CLAUDE_CODE_SUBAGENTS, EFFECTIVE_STANDARDS_AS_CLAUDE_CODE_SKILLS - # compiled_single_command=false for main file (will be true for embedded PHASE files) - content=$(process_conditionals "$content" "${EFFECTIVE_USE_CLAUDE_CODE_SUBAGENTS:-true}" "${EFFECTIVE_STANDARDS_AS_CLAUDE_CODE_SKILLS:-true}" "false") - - # Process workflow replacements - content=$(process_workflows "$content" "$base_dir" "$profile" "") - - # Process standards replacements - local standards_refs=$(echo "$content" | grep -o '{{standards/[^}]*}}' | sort -u) - - while IFS= read -r standards_ref; do - if [[ -z "$standards_ref" ]]; then - continue - fi - - local standards_pattern=$(echo "$standards_ref" | sed 's/{{standards\///' | sed 's/}}//') - local standards_list=$(process_standards "$content" "$base_dir" "$profile" "$standards_pattern") - - # Create temp files for the replacement - local temp_content=$(mktemp) - local temp_standards=$(mktemp) - echo "$content" > "$temp_content" - echo "$standards_list" > "$temp_standards" - - # Use perl to replace without escaping newlines - content=$(perl -e ' - use strict; - use warnings; - - my $ref = $ARGV[0]; - my $standards_file = $ARGV[1]; - my $content_file = $ARGV[2]; - - # Read standards list - open(my $fh, "<", $standards_file) or die $!; - my $standards = do { local $/; <$fh> }; - close($fh); - chomp $standards; - - # Read content - open($fh, "<", $content_file) or die $!; - my $content = do { local $/; <$fh> }; - close($fh); - - # Do the replacement - use quotemeta on entire reference - my $pattern = quotemeta($ref); - $content =~ s/$pattern/$standards/g; - - print $content; - ' "$standards_ref" "$temp_standards" "$temp_content") - - rm -f "$temp_content" "$temp_standards" - done <<< "$standards_refs" - - # Process PHASE tag replacements - content=$(process_phase_tags "$content" "$base_dir" "$profile" "$phase_mode") - - # Replace Playwright in tools - if echo "$content" | grep -q "^tools:.*Playwright"; then - local tools_line=$(echo "$content" | grep "^tools:") - local new_tools_line=$(replace_playwright_tools "$tools_line") - # Simple replacement since this is a single line - content=$(echo "$content" | sed "s|^tools:.*$|$new_tools_line|") - fi - - if [[ "$DRY_RUN" == "true" ]]; then - echo "$dest_file" - else - ensure_dir "$(dirname "$dest_file")" - echo "$content" > "$dest_file" - print_verbose "Compiled agent: $dest_file" - fi -} - -# Compile command file with all replacements -compile_command() { - local source_file=$1 - local dest_file=$2 - local base_dir=$3 - local profile=$4 - local phase_mode=${5:-""} # Optional: "embed" to embed PHASE content, or empty for no processing - - compile_agent "$source_file" "$dest_file" "$base_dir" "$profile" "" "$phase_mode" -} - -# ----------------------------------------------------------------------------- -# Version Functions -# ----------------------------------------------------------------------------- - -# Compare versions (returns 0 if compatible, 1 if not) -check_version_compatibility() { - local base_version=$1 - local project_version=$2 - - # Extract major version - local base_major=$(echo "$base_version" | cut -d'.' -f1) - local project_major=$(echo "$project_version" | cut -d'.' -f1) - - if [[ "$base_major" != "$project_major" ]]; then - return 1 - fi - - return 0 -} - -# Check if project needs migration to 2.1.0 -check_needs_migration() { - local project_version=$1 - - # Empty or missing version needs migration - if [[ -z "$project_version" ]]; then - return 0 # needs migration - fi - - # Parse version components - local major=$(echo "$project_version" | cut -d'.' -f1) - local minor=$(echo "$project_version" | cut -d'.' -f2) - - # Check if < 2.1.0 - if [[ "$major" -lt 2 ]]; then - return 0 # needs migration - elif [[ "$major" -eq 2 ]] && [[ "$minor" -lt 1 ]]; then - return 0 # needs migration - fi - - return 1 # no migration needed -} - -# ----------------------------------------------------------------------------- -# Installation Check Functions -# ----------------------------------------------------------------------------- - -# Check if Agent OS is installed in project -is_agent_os_installed() { - local project_dir=$1 - - if [[ -f "$project_dir/agent-os/config.yml" ]]; then - return 0 - else - return 1 - fi -} - -# Get project installation config -get_project_config() { - local project_dir=$1 - local key=$2 - - get_yaml_value "$project_dir/agent-os/config.yml" "$key" "" -} - -# ----------------------------------------------------------------------------- -# Validation Functions (Common to both scripts) -# ----------------------------------------------------------------------------- - -# Validate base installation exists -validate_base_installation() { - if [[ ! -d "$BASE_DIR" ]]; then - print_error "Agent OS base installation not found at ~/agent-os/" - echo "" - print_status "Please run the base installation first:" - echo " curl -sSL https://raw.githubusercontent.com/buildermethods/agent-os/main/scripts/base-install.sh | bash" - echo "" - exit 1 - fi - - if [[ ! -f "$BASE_DIR/config.yml" ]]; then - print_error "Base installation config.yml not found" - exit 1 - fi - - print_verbose "Base installation found at: $BASE_DIR" -} - -# Check if current directory is the base installation directory -check_not_base_installation() { - if [[ -f "$PROJECT_DIR/agent-os/config.yml" ]]; then - if grep -q "base_install: true" "$PROJECT_DIR/agent-os/config.yml"; then - echo "" - print_error "Cannot install Agent OS in base installation directory" - echo "" - echo "It appears you are in the location of your Agent OS base installation (your home directory)." - echo "To install Agent OS in a project, move to your project's root folder:" - echo "" - echo " cd path/to/project" - echo "" - echo "And then run:" - echo "" - echo " ~/agent-os/scripts/project-install.sh" - echo "" - exit 1 - fi - fi -} - -# ----------------------------------------------------------------------------- -# Argument Parsing Helpers -# ----------------------------------------------------------------------------- - -# Parse boolean flag value -# Outputs: "value shift_count" (e.g., "true 1" or "false 2") -parse_bool_flag() { - local current_value=$1 - local next_value=$2 + # Get parent profile + current=$(get_profile_inherits_from "$config_file" "$current") + done - if [[ "$next_value" == "true" ]] || [[ "$next_value" == "false" ]]; then - echo "$next_value 2" - else - echo "true 1" - fi - return 0 + echo "$chain" } # ----------------------------------------------------------------------------- -# Configuration Loading Helpers +# File Operations # ----------------------------------------------------------------------------- -# Load base installation configuration -load_base_config() { - BASE_VERSION=$(get_yaml_value "$BASE_DIR/config.yml" "version" "2.1.0") - BASE_PROFILE=$(get_yaml_value "$BASE_DIR/config.yml" "profile" "default") - BASE_CLAUDE_CODE_COMMANDS=$(get_yaml_value "$BASE_DIR/config.yml" "claude_code_commands" "true") - BASE_USE_CLAUDE_CODE_SUBAGENTS=$(get_yaml_value "$BASE_DIR/config.yml" "use_claude_code_subagents" "true") - BASE_AGENT_OS_COMMANDS=$(get_yaml_value "$BASE_DIR/config.yml" "agent_os_commands" "false") - BASE_STANDARDS_AS_CLAUDE_CODE_SKILLS=$(get_yaml_value "$BASE_DIR/config.yml" "standards_as_claude_code_skills" "true") - - # Check for old config flags to set variables for validation - MULTI_AGENT_MODE=$(get_yaml_value "$BASE_DIR/config.yml" "multi_agent_mode" "") - SINGLE_AGENT_MODE=$(get_yaml_value "$BASE_DIR/config.yml" "single_agent_mode" "") - MULTI_AGENT_TOOL=$(get_yaml_value "$BASE_DIR/config.yml" "multi_agent_tool" "") -} - -# Load project installation configuration -load_project_config() { - PROJECT_VERSION=$(get_project_config "$PROJECT_DIR" "version") - PROJECT_PROFILE=$(get_project_config "$PROJECT_DIR" "profile") - PROJECT_CLAUDE_CODE_COMMANDS=$(get_project_config "$PROJECT_DIR" "claude_code_commands") - PROJECT_USE_CLAUDE_CODE_SUBAGENTS=$(get_project_config "$PROJECT_DIR" "use_claude_code_subagents") - PROJECT_AGENT_OS_COMMANDS=$(get_project_config "$PROJECT_DIR" "agent_os_commands") - PROJECT_STANDARDS_AS_CLAUDE_CODE_SKILLS=$(get_project_config "$PROJECT_DIR" "standards_as_claude_code_skills") - - # Check for old config flags to set variables for validation - MULTI_AGENT_MODE=$(get_project_config "$PROJECT_DIR" "multi_agent_mode") - SINGLE_AGENT_MODE=$(get_project_config "$PROJECT_DIR" "single_agent_mode") - MULTI_AGENT_TOOL=$(get_project_config "$PROJECT_DIR" "multi_agent_tool") -} - -# Validate configuration -validate_config() { - local claude_code_commands=$1 - local use_claude_code_subagents=$2 - local agent_os_commands=$3 - local standards_as_claude_code_skills=$4 - local profile=$5 - local print_warnings=${6:-true} # Default to true if not provided - - # Validate at least one output is enabled - if [[ "$claude_code_commands" != "true" ]] && [[ "$agent_os_commands" != "true" ]]; then - print_error "At least one of 'claude_code_commands' or 'agent_os_commands' must be true" - exit 1 - fi - - # Validate subagents require Claude Code - if [[ "$use_claude_code_subagents" == "true" ]] && [[ "$claude_code_commands" != "true" ]]; then - if [[ "$print_warnings" == "true" ]]; then - print_warning "use_claude_code_subagents requires claude_code_commands to be true" - print_warning "Ignoring subagent setting" - fi - fi - - # Validate standards as skills require Claude Code - if [[ "$standards_as_claude_code_skills" == "true" ]] && [[ "$claude_code_commands" != "true" ]]; then - if [[ "$print_warnings" == "true" ]]; then - print_warning "standards_as_claude_code_skills requires claude_code_commands to be true" - print_warning "Treating standards_as_claude_code_skills as false" - fi - # Set global variable to override the effective value - EFFECTIVE_STANDARDS_AS_CLAUDE_CODE_SKILLS="false" - fi - - # Validate profile exists - if [[ ! -d "$BASE_DIR/profiles/$profile" ]]; then - print_error "Profile not found: $profile" - exit 1 - fi -} - -# Create or update project config.yml -write_project_config() { - local version=$1 - local profile=$2 - local claude_code_commands=$3 - local use_claude_code_subagents=$4 - local agent_os_commands=$5 - local standards_as_claude_code_skills=$6 - local dest="$PROJECT_DIR/agent-os/config.yml" - - local config_content="version: $version -last_compiled: $(date '+%Y-%m-%d %H:%M:%S') - -# ================================================ -# Compiled with the following settings: -# -# To change these settings, run ~/agent-os/scripts/project-update.sh to re-compile your project with the new settings. -# ================================================ -profile: $profile -claude_code_commands: $claude_code_commands -use_claude_code_subagents: $use_claude_code_subagents -agent_os_commands: $agent_os_commands -standards_as_claude_code_skills: $standards_as_claude_code_skills" - - local result=$(write_file "$config_content" "$dest") - if [[ "$DRY_RUN" == "true" ]]; then - echo "$dest" +# Create directory if it doesn't exist +ensure_dir() { + local dir=$1 + if [[ ! -d "$dir" ]]; then + mkdir -p "$dir" + print_verbose "Created directory: $dir" fi } -# ----------------------------------------------------------------------------- -# Claude Code Skills Functions -# ----------------------------------------------------------------------------- - -# Convert filename to human-readable name with acronym handling -# Returns lowercase with acronyms in uppercase -# Example: "api-design.md" -> "API design" -# "frontend/css.md" -> "frontend CSS" -# "rest-api-conventions.md" -> "REST API conventions" -convert_filename_to_human_name() { - local filename=$1 - - # List of common acronyms to preserve in uppercase - local acronyms=("API" "CSS" "HTML" "SQL" "REST" "JSON" "XML" "HTTP" "HTTPS" "URL" "URI" "CLI" "GUI" "IDE" "SDK" "JWT") - - # Remove .md extension - local name=$(echo "$filename" | sed 's/\.md$//') - - # Replace hyphens, underscores, and slashes with spaces - name=$(echo "$name" | sed 's|[-_/]| |g') - - # Convert to lowercase first - name=$(echo "$name" | tr '[:upper:]' '[:lower:]') - - # Replace known acronyms with uppercase version - # Match all case variations: lowercase, Capitalized, UPPERCASE - for acronym in "${acronyms[@]}"; do - local lowercase=$(echo "$acronym" | tr '[:upper:]' '[:lower:]') - local capitalized=$(echo "$lowercase" | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}') - - # Replace all variations with the uppercase acronym - # Use Perl for portable word boundary matching (\b works consistently across platforms) - name=$(echo "$name" | perl -pe "s/\\b$lowercase\\b/$acronym/g") - name=$(echo "$name" | perl -pe "s/\\b$capitalized\\b/$acronym/g") - name=$(echo "$name" | perl -pe "s/\\b$acronym\\b/$acronym/g") - done - - echo "$name" -} - -# Convert filename to human-readable name with title case and acronym handling -# Returns title case with acronyms in uppercase -# Example: "api-design.md" -> "API Design" -# "frontend/css.md" -> "Frontend CSS" -# "rest-api-conventions.md" -> "REST API Conventions" -convert_filename_to_human_name_capitalized() { - local filename=$1 - - # List of common acronyms to preserve in uppercase - local acronyms=("API" "CSS" "HTML" "SQL" "REST" "JSON" "XML" "HTTP" "HTTPS" "URL" "URI" "CLI" "GUI" "IDE" "SDK" "JWT") - - # Remove .md extension - local name=$(echo "$filename" | sed 's/\.md$//') - - # Replace hyphens, underscores, and slashes with spaces - name=$(echo "$name" | sed 's|[-_/]| |g') - - # Capitalize first letter of each word - name=$(echo "$name" | awk '{for(i=1;i<=NF;i++)sub(/./,toupper(substr($i,1,1)),$i)}1') - - # Replace known acronyms with uppercase version - # Match all case variations: lowercase, Capitalized, UPPERCASE - for acronym in "${acronyms[@]}"; do - local lowercase=$(echo "$acronym" | tr '[:upper:]' '[:lower:]') - local capitalized=$(echo "$lowercase" | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}') - - # Replace all variations with the uppercase acronym - # Use Perl for portable word boundary matching (\b works consistently across platforms) - name=$(echo "$name" | perl -pe "s/\\b$lowercase\\b/$acronym/g") - name=$(echo "$name" | perl -pe "s/\\b$capitalized\\b/$acronym/g") - name=$(echo "$name" | perl -pe "s/\\b$acronym\\b/$acronym/g") - done - echo "$name" -} - -# Create a Claude Code Skill from a standards file -# Args: $1=standards file path (relative to profile, e.g., "standards/frontend/css.md") -# $2=dest base directory (project directory) -# $3=base directory (~/agent-os) -# $4=profile name -create_standard_skill() { - local standards_file=$1 - local dest_base=$2 - local base_dir=$3 - local profile=$4 - - # Remove "standards/" prefix and ".md" extension for skill directory name - # Convert path separators to hyphens - # Example: "standards/frontend/css.md" -> "frontend-css" - local skill_name=$(echo "$standards_file" | sed 's|^standards/||' | sed 's|\.md$||' | sed 's|/|-|g') - - # Get human-readable name from the full path (excluding "standards/") - # Example: "standards/frontend/css.md" -> "frontend CSS" (lowercase) - local path_without_standards=$(echo "$standards_file" | sed 's|^standards/||') - local human_name=$(convert_filename_to_human_name "$path_without_standards") - local human_name_capitalized=$(convert_filename_to_human_name_capitalized "$path_without_standards") - - # Create skill directory (directly in .claude/skills/, not in agent-os subfolder) - local skill_dir="$dest_base/.claude/skills/$skill_name" - ensure_dir "$skill_dir" - - # Get the skill template from the profile - local template_file=$(get_profile_file "$profile" "claude-code-skill-template.md" "$base_dir") - if [[ ! -f "$template_file" ]]; then - print_error "Skill template not found: $template_file" - return 1 - fi - - # Prepend agent-os/ to the standards file path for the file reference - local standard_file_path_with_prefix="agent-os/$standards_file" - - # Read template and replace placeholders - local skill_content=$(cat "$template_file") - skill_content=$(echo "$skill_content" | sed "s|{{standard_name_humanized}}|$human_name|g") - skill_content=$(echo "$skill_content" | sed "s|{{standard_name_humanized_capitalized}}|$human_name_capitalized|g") - skill_content=$(echo "$skill_content" | sed "s|{{standard_file_path}}|$standard_file_path_with_prefix|g") +# Copy file with directory creation +copy_file() { + local source=$1 + local dest=$2 - # Write SKILL.md - local skill_file="$skill_dir/SKILL.md" - if [[ "$DRY_RUN" == "true" ]]; then - echo "$skill_file" - else - echo "$skill_content" > "$skill_file" - print_verbose "Created skill: $skill_file" - fi + ensure_dir "$(dirname "$dest")" + cp "$source" "$dest" + print_verbose "Copied: $source -> $dest" } -# Install Claude Code Skills from standards files -install_claude_code_skills() { - # Only install skills if both flags are enabled - if [[ "$EFFECTIVE_STANDARDS_AS_CLAUDE_CODE_SKILLS" != "true" ]] || [[ "$EFFECTIVE_CLAUDE_CODE_COMMANDS" != "true" ]]; then - return 0 - fi - - if [[ "$DRY_RUN" != "true" ]]; then - print_status "Installing Claude Code Skills..." - fi - - local skills_count=0 +# Copy directory contents recursively (excluding .backups/) +copy_standards() { + local source_dir=$1 + local dest_dir=$2 + local count=0 - # Get all standards files for the current profile - while read file; do - if [[ "$file" == standards/* ]] && [[ "$file" == *.md ]]; then - # Create skill from this standards file - create_standard_skill "$file" "$PROJECT_DIR" "$BASE_DIR" "$EFFECTIVE_PROFILE" - - # Track the skill file for dry run - local skill_name=$(echo "$file" | sed 's|^standards/||' | sed 's|\.md$||' | sed 's|/|-|g') - local skill_file="$PROJECT_DIR/.claude/skills/$skill_name/SKILL.md" - if [[ "$DRY_RUN" == "true" ]]; then - INSTALLED_FILES+=("$skill_file") - fi - ((skills_count++)) || true - fi - done < <(get_profile_files "$EFFECTIVE_PROFILE" "$BASE_DIR" "standards") - - if [[ "$DRY_RUN" != "true" ]]; then - if [[ $skills_count -gt 0 ]]; then - echo "βœ“ Installed $skills_count Claude Code Skills" - echo -e "${YELLOW} πŸ‘‰ Be sure to run the /improve-skills command next using Claude Code${NC}" - fi - fi -} - -# Install improve-skills command (only when Skills are enabled) -install_improve_skills_command() { - # Only install if both Claude Code commands AND Skills are enabled - if [[ "$EFFECTIVE_STANDARDS_AS_CLAUDE_CODE_SKILLS" != "true" ]] || [[ "$EFFECTIVE_CLAUDE_CODE_COMMANDS" != "true" ]]; then + if [[ ! -d "$source_dir" ]]; then return 0 fi - local target_dir="$PROJECT_DIR/.claude/commands/agent-os" - mkdir -p "$target_dir" - - # Find the improve-skills command file - local source_file=$(get_profile_file "$EFFECTIVE_PROFILE" "commands/improve-skills/improve-skills.md" "$BASE_DIR") + ensure_dir "$dest_dir" - if [[ -f "$source_file" ]]; then - local dest="$target_dir/improve-skills.md" + # Find all .md files, excluding .backups directory + while IFS= read -r -d '' file; do + local relative_path="${file#$source_dir/}" + local dest_file="$dest_dir/$relative_path" - # Compile the command (with workflow and standards injection) - local compiled=$(compile_command "$source_file" "$dest" "$BASE_DIR" "$EFFECTIVE_PROFILE") + ensure_dir "$(dirname "$dest_file")" + cp "$file" "$dest_file" + ((count++)) + done < <(find "$source_dir" -name "*.md" -type f ! -path "*/.backups/*" -print0 2>/dev/null) - if [[ "$DRY_RUN" == "true" ]]; then - INSTALLED_FILES+=("$dest") - fi - fi + echo "$count" } diff --git a/scripts/create-profile.sh b/scripts/create-profile.sh deleted file mode 100755 index 5e7b3881..00000000 --- a/scripts/create-profile.sh +++ /dev/null @@ -1,326 +0,0 @@ -#!/bin/bash - -# ============================================================================= -# Agent OS Create Profile Script -# Creates a new profile for Agent OS -# ============================================================================= - -set -e # Exit on error - -# Get the directory where this script is located -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -BASE_DIR="$HOME/agent-os" -PROFILES_DIR="$BASE_DIR/profiles" - -# Source common functions -source "$SCRIPT_DIR/common-functions.sh" - -# ----------------------------------------------------------------------------- -# Default Values -# ----------------------------------------------------------------------------- - -PROFILE_NAME="" -INHERIT_FROM="" -COPY_FROM="" - -# ----------------------------------------------------------------------------- -# Validation Functions -# ----------------------------------------------------------------------------- - -validate_installation() { - # Check base installation - validate_base_installation - - if [[ ! -d "$PROFILES_DIR" ]]; then - print_error "Profiles directory not found at $PROFILES_DIR" - exit 1 - fi -} - -# ----------------------------------------------------------------------------- -# Profile Functions -# ----------------------------------------------------------------------------- - -get_available_profiles() { - local profiles=() - - # Find all directories in profiles/ - for dir in "$PROFILES_DIR"/*; do - if [[ -d "$dir" ]]; then - profiles+=("$(basename "$dir")") - fi - done - - echo "${profiles[@]}" -} - -# ----------------------------------------------------------------------------- -# Profile Name Input -# ----------------------------------------------------------------------------- - -get_profile_name() { - local valid=false - - while [[ "$valid" == "false" ]]; do - echo "" - echo "" - echo "" - print_status "Enter a name for the new profile:" - echo "Example names: 'rails', 'python', 'react', 'wordpress'" - echo "" - - read -p "$(echo -e "${BLUE}Profile name: ${NC}")" profile_input - - # Normalize the name - PROFILE_NAME=$(normalize_name "$profile_input") - - if [[ -z "$PROFILE_NAME" ]]; then - print_error "Profile name cannot be empty" - continue - fi - - # Check if profile already exists - if [[ -d "$PROFILES_DIR/$PROFILE_NAME" ]]; then - print_error "Profile '$PROFILE_NAME' already exists" - echo "Please choose a different name" - continue - fi - - valid=true - print_success "Profile name set to: $PROFILE_NAME" - done -} - -# ----------------------------------------------------------------------------- -# Inheritance Selection -# ----------------------------------------------------------------------------- - -select_inheritance() { - local profiles=($(get_available_profiles)) - - if [[ ${#profiles[@]} -eq 0 ]]; then - print_warning "No existing profiles found to inherit from" - INHERIT_FROM="" - return - fi - - echo "" - echo "" - echo "" - - if [[ ${#profiles[@]} -eq 1 ]]; then - # Only one profile exists - print_status "Should this profile inherit from the '${profiles[0]}' profile?" - echo "" - read -p "$(echo -e "${BLUE}Inherit from '${profiles[0]}'? (y/n): ${NC}")" inherit_choice - - if [[ "$inherit_choice" == "y" ]] || [[ "$inherit_choice" == "Y" ]]; then - INHERIT_FROM="${profiles[0]}" - print_success "Profile will inherit from: $INHERIT_FROM" - else - INHERIT_FROM="" - print_status "Profile will not inherit from any profile" - fi - else - # Multiple profiles exist - print_status "Select a profile to inherit from:" - echo "" - echo " 1) Don't inherit from any profile" - - local index=2 - for profile in "${profiles[@]}"; do - echo " $index) $profile" - ((index++)) || true - done - - echo "" - read -p "$(echo -e "${BLUE}Enter selection (1-$((${#profiles[@]}+1))): ${NC}")" selection - - if [[ "$selection" == "1" ]]; then - INHERIT_FROM="" - print_status "Profile will not inherit from any profile" - elif [[ "$selection" =~ ^[0-9]+$ ]] && [[ "$selection" -ge 2 ]] && [[ "$selection" -le $((${#profiles[@]}+1)) ]]; then - INHERIT_FROM="${profiles[$((selection-2))]}" - print_success "Profile will inherit from: $INHERIT_FROM" - else - print_error "Invalid selection" - exit 1 - fi - fi -} - -# ----------------------------------------------------------------------------- -# Copy Selection -# ----------------------------------------------------------------------------- - -select_copy_source() { - # Only ask about copying if not inheriting - if [[ -n "$INHERIT_FROM" ]]; then - COPY_FROM="" - return - fi - - local profiles=($(get_available_profiles)) - - if [[ ${#profiles[@]} -eq 0 ]]; then - print_warning "No existing profiles found to copy from" - COPY_FROM="" - return - fi - - echo "" - echo "" - echo "" - - if [[ ${#profiles[@]} -eq 1 ]]; then - # Only one profile exists - print_status "Do you want to copy the contents from the '${profiles[0]}' profile?" - echo "" - read -p "$(echo -e "${BLUE}Copy from '${profiles[0]}'? (y/n): ${NC}")" copy_choice - - if [[ "$copy_choice" == "y" ]] || [[ "$copy_choice" == "Y" ]]; then - COPY_FROM="${profiles[0]}" - print_success "Will copy contents from: $COPY_FROM" - else - COPY_FROM="" - print_status "Will create empty profile structure" - fi - else - # Multiple profiles exist - print_status "Select a profile to copy from:" - echo "" - echo " 1) Don't copy from any profile" - - local index=2 - for profile in "${profiles[@]}"; do - echo " $index) $profile" - ((index++)) || true - done - - echo "" - read -p "$(echo -e "${BLUE}Enter selection (1-$((${#profiles[@]}+1))): ${NC}")" selection - - if [[ "$selection" == "1" ]]; then - COPY_FROM="" - print_status "Will create empty profile structure" - elif [[ "$selection" =~ ^[0-9]+$ ]] && [[ "$selection" -ge 2 ]] && [[ "$selection" -le $((${#profiles[@]}+1)) ]]; then - COPY_FROM="${profiles[$((selection-2))]}" - print_success "Will copy contents from: $COPY_FROM" - else - print_error "Invalid selection" - exit 1 - fi - fi -} - -# ----------------------------------------------------------------------------- -# Profile Creation -# ----------------------------------------------------------------------------- - -create_profile_structure() { - local profile_path="$PROFILES_DIR/$PROFILE_NAME" - - print_status "Creating profile structure..." - - if [[ -n "$COPY_FROM" ]]; then - # Copy from existing profile - print_status "Copying from profile: $COPY_FROM" - cp -r "$PROFILES_DIR/$COPY_FROM" "$profile_path" - - # Update profile-config.yml - cat > "$profile_path/profile-config.yml" << EOF -inherits_from: false - -# Profile configuration for $PROFILE_NAME -# Copied from: $COPY_FROM -EOF - - print_success "Profile copied and configured" - - else - # Create new structure - mkdir -p "$profile_path" - - # Create standard directories - mkdir -p "$profile_path/standards/" - mkdir -p "$profile_path/workflows/implementation" - mkdir -p "$profile_path/workflows/planning" - mkdir -p "$profile_path/workflows/specification" - - # Create profile-config.yml - if [[ -n "$INHERIT_FROM" ]]; then - cat > "$profile_path/profile-config.yml" << EOF -inherits_from: $INHERIT_FROM - -# Uncomment and modify to exclude specific inherited files: -# exclude_inherited_files: -# - standards/backend/api/* -# - standards/backend/database/migrations.md -# - workflows/implementation/specific-workflow.md -EOF - else - cat > "$profile_path/profile-config.yml" << EOF -inherits_from: false - -# Profile configuration for $PROFILE_NAME -EOF - fi - - print_success "Profile structure created" - fi -} - -# ----------------------------------------------------------------------------- -# Main Execution -# ----------------------------------------------------------------------------- - -main() { - clear - echo "" - echo -e "${BLUE}=== Agent OS - Create Profile Utility ===${NC}" - echo "" - - # Validate installation - validate_installation - - # Get profile name - get_profile_name - - # Select inheritance - select_inheritance - - # Select copy source (if not inheriting) - select_copy_source - - # Create the profile - create_profile_structure - - # Success message - echo "" - echo -e "${GREEN}════════════════════════════════════════════${NC}" - echo "" - print_success "Profile '$PROFILE_NAME' has been successfully created!" - echo "" - print_status "Location: $PROFILES_DIR/$PROFILE_NAME" - - if [[ -n "$INHERIT_FROM" ]]; then - echo "" - print_status "This profile inherits from: $INHERIT_FROM" - elif [[ -n "$COPY_FROM" ]]; then - echo "" - print_status "This profile was copied from: $COPY_FROM" - fi - - echo "" - print_status "Next steps:" - echo " 1. Customize standards, workflows, and configurations in your profile" - echo " 2. Install Agent OS in a project using this profile with: ~/agent-os/scripts/project-install.sh --profile $PROFILE_NAME" - echo "" - echo -e "${GREEN}Visit the docs on customizing your profile: https://buildermethods.com/agent-os/profiles${NC}" - echo "" - echo -e "${GREEN}════════════════════════════════════════════${NC}" - echo "" -} - -# Run main function -main "$@" diff --git a/scripts/project-install.sh b/scripts/project-install.sh index 295dfae3..8688d4ad 100755 --- a/scripts/project-install.sh +++ b/scripts/project-install.sh @@ -5,11 +5,11 @@ # Installs Agent OS into a project's codebase # ============================================================================= -set -e # Exit on error +set -e # Get the directory where this script is located SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -BASE_DIR="$HOME/agent-os" +BASE_DIR="$(dirname "$SCRIPT_DIR")" PROJECT_DIR="$(pwd)" # Source common functions @@ -19,19 +19,9 @@ source "$SCRIPT_DIR/common-functions.sh" # Default Values # ----------------------------------------------------------------------------- -DRY_RUN="false" VERBOSE="false" PROFILE="" -CLAUDE_CODE_COMMANDS="" -USE_CLAUDE_CODE_SUBAGENTS="" -AGENT_OS_COMMANDS="" -STANDARDS_AS_CLAUDE_CODE_SKILLS="" -RE_INSTALL="false" -OVERWRITE_ALL="false" -OVERWRITE_STANDARDS="false" -OVERWRITE_COMMANDS="false" -OVERWRITE_AGENTS="false" -INSTALLED_FILES=() +COMMANDS_ONLY="false" # ----------------------------------------------------------------------------- # Help Function @@ -44,27 +34,15 @@ Usage: $0 [OPTIONS] Install Agent OS into the current project directory. Options: - --profile PROFILE Use specified profile (default: from config.yml) - --claude-code-commands [BOOL] Install Claude Code commands (default: from config.yml) - --use-claude-code-subagents [BOOL] Use Claude Code subagents (default: from config.yml) - --agent-os-commands [BOOL] Install agent-os commands (default: from config.yml) - --standards-as-claude-code-skills [BOOL] Use Claude Code Skills for standards (default: from config.yml) - --re-install Delete and reinstall Agent OS - --overwrite-all Overwrite all existing files during update - --overwrite-standards Overwrite existing standards during update - --overwrite-commands Overwrite existing commands during update - --overwrite-agents Overwrite existing agents during update - --dry-run Show what would be done without doing it - --verbose Show detailed output - -h, --help Show this help message - -Note: Flags accept both hyphens and underscores (e.g., --use-claude-code-subagents or --use_claude_code_subagents) + --profile Use specified profile (default: from config.yml) + --commands-only Only update commands, preserve existing standards + --verbose Show detailed output + -h, --help Show this help message Examples: $0 $0 --profile rails - $0 --claude-code-commands true --use-claude-code-subagents true - $0 --agent-os-commands true --dry-run + $0 --commands-only EOF exit 0 @@ -76,52 +54,13 @@ EOF parse_arguments() { while [[ $# -gt 0 ]]; do - # Normalize flag by replacing underscores with hyphens - local flag="${1//_/-}" - - case $flag in + case $1 in --profile) PROFILE="$2" shift 2 ;; - --claude-code-commands) - read CLAUDE_CODE_COMMANDS shift_count <<< "$(parse_bool_flag "$CLAUDE_CODE_COMMANDS" "$2")" - shift $shift_count - ;; - --use-claude-code-subagents) - read USE_CLAUDE_CODE_SUBAGENTS shift_count <<< "$(parse_bool_flag "$USE_CLAUDE_CODE_SUBAGENTS" "$2")" - shift $shift_count - ;; - --agent-os-commands) - read AGENT_OS_COMMANDS shift_count <<< "$(parse_bool_flag "$AGENT_OS_COMMANDS" "$2")" - shift $shift_count - ;; - --standards-as-claude-code-skills) - read STANDARDS_AS_CLAUDE_CODE_SKILLS shift_count <<< "$(parse_bool_flag "$STANDARDS_AS_CLAUDE_CODE_SKILLS" "$2")" - shift $shift_count - ;; - --re-install) - RE_INSTALL="true" - shift - ;; - --overwrite-all) - OVERWRITE_ALL="true" - shift - ;; - --overwrite-standards) - OVERWRITE_STANDARDS="true" - shift - ;; - --overwrite-commands) - OVERWRITE_COMMANDS="true" - shift - ;; - --overwrite-agents) - OVERWRITE_AGENTS="true" - shift - ;; - --dry-run) - DRY_RUN="true" + --commands-only) + COMMANDS_ONLY="true" shift ;; --verbose) @@ -140,380 +79,335 @@ parse_arguments() { } # ----------------------------------------------------------------------------- -# Configuration Functions +# Validation Functions # ----------------------------------------------------------------------------- -load_configuration() { - # Load base configuration using common function - load_base_config - - # Set effective values (command line overrides base config) - EFFECTIVE_PROFILE="${PROFILE:-$BASE_PROFILE}" - EFFECTIVE_CLAUDE_CODE_COMMANDS="${CLAUDE_CODE_COMMANDS:-$BASE_CLAUDE_CODE_COMMANDS}" - EFFECTIVE_USE_CLAUDE_CODE_SUBAGENTS="${USE_CLAUDE_CODE_SUBAGENTS:-$BASE_USE_CLAUDE_CODE_SUBAGENTS}" - EFFECTIVE_AGENT_OS_COMMANDS="${AGENT_OS_COMMANDS:-$BASE_AGENT_OS_COMMANDS}" - EFFECTIVE_STANDARDS_AS_CLAUDE_CODE_SKILLS="${STANDARDS_AS_CLAUDE_CODE_SKILLS:-$BASE_STANDARDS_AS_CLAUDE_CODE_SKILLS}" - EFFECTIVE_VERSION="$BASE_VERSION" - - # Validate configuration using common function (may override EFFECTIVE_STANDARDS_AS_CLAUDE_CODE_SKILLS if dependency not met) - validate_config "$EFFECTIVE_CLAUDE_CODE_COMMANDS" "$EFFECTIVE_USE_CLAUDE_CODE_SUBAGENTS" "$EFFECTIVE_AGENT_OS_COMMANDS" "$EFFECTIVE_STANDARDS_AS_CLAUDE_CODE_SKILLS" "$EFFECTIVE_PROFILE" - - print_verbose "Configuration loaded:" - print_verbose " Profile: $EFFECTIVE_PROFILE" - print_verbose " Claude Code commands: $EFFECTIVE_CLAUDE_CODE_COMMANDS" - print_verbose " Use Claude Code subagents: $EFFECTIVE_USE_CLAUDE_CODE_SUBAGENTS" - print_verbose " Agent OS commands: $EFFECTIVE_AGENT_OS_COMMANDS" - print_verbose " Standards as Claude Code Skills: $EFFECTIVE_STANDARDS_AS_CLAUDE_CODE_SKILLS" +validate_base_installation() { + if [[ ! -d "$BASE_DIR" ]]; then + print_error "Agent OS base installation not found" + exit 1 + fi + + if [[ ! -f "$BASE_DIR/config.yml" ]]; then + print_error "Base installation config.yml not found" + exit 1 + fi +} + +validate_not_in_base() { + if [[ "$PROJECT_DIR" == "$BASE_DIR" ]]; then + print_error "Cannot install Agent OS in the base installation directory" + echo "" + echo "Navigate to your project directory first:" + echo " cd /path/to/your/project" + echo "" + exit 1 + fi } # ----------------------------------------------------------------------------- -# Installation Functions +# Configuration Functions # ----------------------------------------------------------------------------- -# Install standards files -install_standards() { - if [[ "$DRY_RUN" != "true" ]]; then - print_status "Installing standards" - fi +load_configuration() { + local config_file="$BASE_DIR/config.yml" - local standards_count=0 + # Get default profile from config + local default_profile=$(get_yaml_value "$config_file" "default_profile" "default") - while read file; do - if [[ "$file" == standards/* ]]; then - local source=$(get_profile_file "$EFFECTIVE_PROFILE" "$file" "$BASE_DIR") - local dest="$PROJECT_DIR/agent-os/$file" + # Use command line profile or default + EFFECTIVE_PROFILE="${PROFILE:-$default_profile}" - if [[ -f "$source" ]]; then - local installed_file=$(copy_file "$source" "$dest") - if [[ -n "$installed_file" ]]; then - INSTALLED_FILES+=("$installed_file") - ((standards_count++)) || true - fi - fi - fi - done < <(get_profile_files "$EFFECTIVE_PROFILE" "$BASE_DIR" "standards") + # Validate profile exists + if [[ ! -d "$BASE_DIR/profiles/$EFFECTIVE_PROFILE" ]]; then + print_error "Profile not found: $EFFECTIVE_PROFILE" + exit 1 + fi - if [[ "$DRY_RUN" != "true" ]]; then - if [[ $standards_count -gt 0 ]]; then - echo "βœ“ Installed $standards_count standards in agent-os/standards" - fi + # Build inheritance chain + local chain_result=$(get_profile_inheritance_chain "$config_file" "$EFFECTIVE_PROFILE" "$BASE_DIR/profiles") + + # Check for errors + if [[ "$chain_result" == CIRCULAR:* ]]; then + local cycle_path="${chain_result#CIRCULAR:}" + echo "" + print_error "Circular dependency detected in profile inheritance chain:" + echo " $cycle_path" + echo "" + echo "Please fix the inheritance configuration in:" + echo " $config_file" + echo "" + echo "The 'profiles' section contains a circular reference that must be resolved." + exit 1 fi -} -# Install and compile single-agent mode commands -# Install Claude Code commands with delegation (multi-agent files) -install_claude_code_commands_with_delegation() { - if [[ "$DRY_RUN" != "true" ]]; then - print_status "Installing Claude Code commands (with delegation to subagents)..." + if [[ "$chain_result" == NOTFOUND:* ]]; then + local missing_profile="${chain_result#NOTFOUND:}" + print_error "Profile not found: $missing_profile" + echo "" + echo "This profile is referenced in the inheritance chain but doesn't exist." + echo "Check the 'profiles' section in: $config_file" + exit 1 fi - local commands_count=0 - local target_dir="$PROJECT_DIR/.claude/commands/agent-os" + # Store the inheritance chain (newline-separated, base first) + INHERITANCE_CHAIN="$chain_result" - mkdir -p "$target_dir" + print_verbose "Using profile: $EFFECTIVE_PROFILE" + print_verbose "Inheritance chain: $(echo "$INHERITANCE_CHAIN" | tr '\n' ' ')" +} - while read file; do - # Process multi-agent command files OR orchestrate-tasks special case - if [[ "$file" == commands/*/multi-agent/* ]] || [[ "$file" == commands/orchestrate-tasks/orchestrate-tasks.md ]]; then - local source=$(get_profile_file "$EFFECTIVE_PROFILE" "$file" "$BASE_DIR") - if [[ -f "$source" ]]; then - # Extract command name from path (e.g., commands/create-spec/multi-agent/create-spec.md -> create-spec) - local cmd_name=$(echo "$file" | cut -d'/' -f2) - local dest="$target_dir/${cmd_name}.md" +# ----------------------------------------------------------------------------- +# Confirmation Functions +# ----------------------------------------------------------------------------- - # Compile with workflow and standards injection (includes conditional compilation) - local compiled=$(compile_command "$source" "$dest" "$BASE_DIR" "$EFFECTIVE_PROFILE") - if [[ "$DRY_RUN" == "true" ]]; then - INSTALLED_FILES+=("$dest") - fi - ((commands_count++)) || true - fi - fi - done < <(get_profile_files "$EFFECTIVE_PROFILE" "$BASE_DIR" "commands") +confirm_standards_overwrite() { + if [[ "$COMMANDS_ONLY" == "true" ]]; then + return 0 + fi + + local existing_standards="$PROJECT_DIR/agent-os/standards" - if [[ "$DRY_RUN" != "true" ]]; then - if [[ $commands_count -gt 0 ]]; then - echo "βœ“ Installed $commands_count Claude Code commands (with delegation)" + if [[ -d "$existing_standards" ]]; then + echo "" + print_warning "Existing standards folder detected at: $existing_standards" + echo "" + echo "This will overwrite your existing standards with standards from the '$EFFECTIVE_PROFILE' profile." + echo "" + read -p "Do you want to continue? (y/N) " -n 1 -r + echo "" + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "" + echo "Installation cancelled." + echo "" + echo "To update only commands without touching standards, use:" + echo " $0 --commands-only" + echo "" + exit 0 fi fi } -# Install Claude Code commands without delegation (single-agent files with injection) -install_claude_code_commands_without_delegation() { - if [[ "$DRY_RUN" != "true" ]]; then - print_status "Installing Claude Code commands (without delegation)..." - fi +# ----------------------------------------------------------------------------- +# Installation Functions +# ----------------------------------------------------------------------------- - local commands_count=0 - - while read file; do - # Process single-agent command files OR orchestrate-tasks special case - if [[ "$file" == commands/*/single-agent/* ]] || [[ "$file" == commands/orchestrate-tasks/orchestrate-tasks.md ]]; then - local source=$(get_profile_file "$EFFECTIVE_PROFILE" "$file" "$BASE_DIR") - if [[ -f "$source" ]]; then - # Handle orchestrate-tasks specially (flat destination) - if [[ "$file" == commands/orchestrate-tasks/orchestrate-tasks.md ]]; then - local dest="$PROJECT_DIR/.claude/commands/agent-os/orchestrate-tasks.md" - # Compile without PHASE embedding for orchestrate-tasks - local compiled=$(compile_command "$source" "$dest" "$BASE_DIR" "$EFFECTIVE_PROFILE" "") - if [[ "$DRY_RUN" == "true" ]]; then - INSTALLED_FILES+=("$dest") - fi - ((commands_count++)) || true - else - # Only install non-numbered files (e.g., plan-product.md, not 1-product-concept.md) - local filename=$(basename "$file") - if [[ ! "$filename" =~ ^[0-9]+-.*\.md$ ]]; then - # Extract command name (e.g., commands/plan-product/single-agent/plan-product.md -> plan-product.md) - local cmd_name=$(echo "$file" | sed 's|commands/\([^/]*\)/single-agent/.*|\1|') - local dest="$PROJECT_DIR/.claude/commands/agent-os/$cmd_name.md" - - # Compile with PHASE embedding (mode="embed") - local compiled=$(compile_command "$source" "$dest" "$BASE_DIR" "$EFFECTIVE_PROFILE" "embed") - if [[ "$DRY_RUN" == "true" ]]; then - INSTALLED_FILES+=("$dest") - fi - ((commands_count++)) || true - fi - fi - fi - fi - done < <(get_profile_files "$EFFECTIVE_PROFILE" "$BASE_DIR" "commands") +create_project_structure() { + print_status "Creating project structure..." - if [[ "$DRY_RUN" != "true" ]]; then - if [[ $commands_count -gt 0 ]]; then - echo "βœ“ Installed $commands_count Claude Code commands (without delegation)" - fi - fi + ensure_dir "$PROJECT_DIR/agent-os" + ensure_dir "$PROJECT_DIR/agent-os/standards" + + print_success "Created agent-os/ directory structure" } -# Install Claude Code static agents -install_claude_code_agents() { - if [[ "$DRY_RUN" != "true" ]]; then - print_status "Installing Claude Code agents..." +install_standards() { + if [[ "$COMMANDS_ONLY" == "true" ]]; then + print_status "Skipping standards (--commands-only)" + return fi - local agents_count=0 - local target_dir="$PROJECT_DIR/.claude/agents/agent-os" - - mkdir -p "$target_dir" - - while read file; do - # Include all agent files (flatten structure - no subfolders in output) - if [[ "$file" == agents/*.md ]] && [[ "$file" != agents/templates/* ]]; then - local source=$(get_profile_file "$EFFECTIVE_PROFILE" "$file" "$BASE_DIR") - if [[ -f "$source" ]]; then - # Get just the filename (flatten directory structure) - local filename=$(basename "$file") - local dest="$target_dir/$filename" - - # Compile with workflow and standards injection - local compiled=$(compile_agent "$source" "$dest" "$BASE_DIR" "$EFFECTIVE_PROFILE" "") - if [[ "$DRY_RUN" == "true" ]]; then - INSTALLED_FILES+=("$dest") - fi - ((agents_count++)) || true - fi + echo "" + print_status "Installing standards..." + + local project_standards="$PROJECT_DIR/agent-os/standards" + local profiles_used=0 + + # Temp file to track file sources (format: relative_path|profile_name) + local sources_file=$(mktemp) + trap "rm -f $sources_file" EXIT + + # Process each profile in the inheritance chain (base first, so later ones override) + while IFS= read -r profile_name; do + [[ -z "$profile_name" ]] && continue + + local profile_standards="$BASE_DIR/profiles/$profile_name/standards" + + if [[ ! -d "$profile_standards" ]]; then + continue fi - done < <(get_profile_files "$EFFECTIVE_PROFILE" "$BASE_DIR" "agents") - if [[ "$DRY_RUN" != "true" ]]; then - if [[ $agents_count -gt 0 ]]; then - echo "βœ“ Installed $agents_count Claude Code agents" + local profile_file_count=0 + + # Find all .md files in this profile, excluding .backups + while IFS= read -r -d '' file; do + local relative_path="${file#$profile_standards/}" + local dest_file="$project_standards/$relative_path" + + ensure_dir "$(dirname "$dest_file")" + cp "$file" "$dest_file" + + # Track the source - remove old entry if exists, add new one + grep -v "^${relative_path}|" "$sources_file" > "${sources_file}.tmp" 2>/dev/null || true + mv "${sources_file}.tmp" "$sources_file" + echo "${relative_path}|${profile_name}" >> "$sources_file" + ((profile_file_count++)) + done < <(find "$profile_standards" -name "*.md" -type f ! -path "*/.backups/*" -print0 2>/dev/null) + + if [[ "$profile_file_count" -gt 0 ]]; then + ((profiles_used++)) fi - fi -} + done <<< "$INHERITANCE_CHAIN" -# Install agent-os commands (single-agent files with injection) -install_agent_os_commands() { - if [[ "$DRY_RUN" != "true" ]]; then - print_status "Installing agent-os commands..." - fi + # Count profiles in chain to determine if we show sources + local chain_count=$(echo "$INHERITANCE_CHAIN" | grep -c .) - local commands_count=0 - - while read file; do - # Process single-agent command files OR orchestrate-tasks special case - if [[ "$file" == commands/*/single-agent/* ]] || [[ "$file" == commands/orchestrate-tasks/orchestrate-tasks.md ]]; then - local source=$(get_profile_file "$EFFECTIVE_PROFILE" "$file" "$BASE_DIR") - if [[ -f "$source" ]]; then - # Handle orchestrate-tasks specially (preserve folder structure) - if [[ "$file" == commands/orchestrate-tasks/orchestrate-tasks.md ]]; then - local dest="$PROJECT_DIR/agent-os/commands/orchestrate-tasks/orchestrate-tasks.md" - else - # Extract command name and preserve numbering - local cmd_path=$(echo "$file" | sed 's|commands/\([^/]*\)/single-agent/\(.*\)|\1/\2|') - local dest="$PROJECT_DIR/agent-os/commands/$cmd_path" - fi + # Count and display + local total_count=$(wc -l < "$sources_file" | tr -d ' ') - # Compile with workflow and standards injection and PHASE embedding - local compiled=$(compile_command "$source" "$dest" "$BASE_DIR" "$EFFECTIVE_PROFILE" "embed") - if [[ "$DRY_RUN" == "true" ]]; then - INSTALLED_FILES+=("$dest") - fi - ((commands_count++)) || true + if [[ "$total_count" -gt 0 ]]; then + # Sort and display files - only show source if inheritance is present + sort "$sources_file" | while IFS='|' read -r filepath profile; do + if [[ "$chain_count" -gt 1 ]]; then + echo " $filepath (from $profile)" + else + echo " $filepath" fi - fi - done < <(get_profile_files "$EFFECTIVE_PROFILE" "$BASE_DIR" "commands") + done - if [[ "$DRY_RUN" != "true" ]]; then - if [[ $commands_count -gt 0 ]]; then - echo "βœ“ Installed $commands_count agent-os commands" + if [[ "$profiles_used" -gt 1 ]]; then + print_success "Installed $total_count standards files (from $profiles_used profiles)" + else + print_success "Installed $total_count standards files" fi + else + print_success "No standards to install (profile is empty)" fi } -# Create agent-os folder structure -create_agent_os_folder() { - if [[ "$DRY_RUN" != "true" ]]; then - print_status "Installing agent-os folder" - fi +create_index() { + echo "" + print_status "Updating standards index..." - # Create the main agent-os folder - ensure_dir "$PROJECT_DIR/agent-os" + local standards_dir="$PROJECT_DIR/agent-os/standards" + local index_file="$standards_dir/index.yml" + local temp_file="$standards_dir/.index_temp.yml" + local old_index="" - # Create the configuration file - local config_file=$(write_project_config "$EFFECTIVE_VERSION" "$EFFECTIVE_PROFILE" \ - "$EFFECTIVE_CLAUDE_CODE_COMMANDS" "$EFFECTIVE_USE_CLAUDE_CODE_SUBAGENTS" \ - "$EFFECTIVE_AGENT_OS_COMMANDS" "$EFFECTIVE_STANDARDS_AS_CLAUDE_CODE_SKILLS") - if [[ "$DRY_RUN" == "true" && -n "$config_file" ]]; then - INSTALLED_FILES+=("$config_file") + # Save existing index content for description lookup + if [[ -f "$index_file" ]]; then + old_index=$(cat "$index_file") fi - if [[ "$DRY_RUN" != "true" ]]; then - echo "βœ“ Created agent-os folder" - echo "βœ“ Created agent-os project configuration" - fi -} + local entry_count=0 + local new_count=0 -# Perform fresh installation -perform_installation() { - # Show dry run warning at the top if applicable - if [[ "$DRY_RUN" == "true" ]]; then - print_warning "DRY RUN - No files will be actually created" - echo "" - fi + # Start fresh + echo "# Agent OS Standards Index" > "$temp_file" + echo "" >> "$temp_file" - # Display configuration at the top - echo "" - print_status "Configuration:" - echo -e " Profile: ${YELLOW}$EFFECTIVE_PROFILE${NC}" - echo -e " Claude Code commands: ${YELLOW}$EFFECTIVE_CLAUDE_CODE_COMMANDS${NC}" - echo -e " Use Claude Code subagents: ${YELLOW}$EFFECTIVE_USE_CLAUDE_CODE_SUBAGENTS${NC}" - echo -e " Standards as Claude Code Skills: ${YELLOW}$EFFECTIVE_STANDARDS_AS_CLAUDE_CODE_SKILLS${NC}" - echo -e " Agent OS commands: ${YELLOW}$EFFECTIVE_AGENT_OS_COMMANDS${NC}" - echo "" + # Helper to get existing description from old index + # Looks for pattern: folder:\n filename:\n description: ... + get_existing_description() { + local folder="$1" + local filename="$2" - # In dry run mode, just collect files silently - if [[ "$DRY_RUN" == "true" ]]; then - # Collect files without output - create_agent_os_folder - install_standards - - # Install Claude Code files if enabled - if [[ "$EFFECTIVE_CLAUDE_CODE_COMMANDS" == "true" ]]; then - if [[ "$EFFECTIVE_USE_CLAUDE_CODE_SUBAGENTS" == "true" ]]; then - install_claude_code_commands_with_delegation - install_claude_code_agents - else - install_claude_code_commands_without_delegation - fi - install_claude_code_skills - install_improve_skills_command + if [[ -z "$old_index" ]]; then + return 1 fi - # Install agent-os commands if enabled - if [[ "$EFFECTIVE_AGENT_OS_COMMANDS" == "true" ]]; then - install_agent_os_commands + # Use awk to find the description for this folder/file combo + local desc=$(echo "$old_index" | awk -v folder="$folder" -v file="$filename" ' + $0 ~ "^"folder":$" { in_folder=1; next } + /^[a-zA-Z0-9_-]+:$/ { in_folder=0 } + in_folder && $0 ~ "^ "file":$" { in_file=1; next } + in_folder && /^ [a-zA-Z0-9_-]+:$/ { in_file=0 } + in_folder && in_file && /description:/ { + sub(/^[[:space:]]*description:[[:space:]]*/, "") + print + exit + } + ') + + if [[ -n "$desc" && "$desc" != "Needs description - run /index-standards" ]]; then + echo "$desc" + return 0 fi - - echo "" - print_status "The following files would be created:" - for file in "${INSTALLED_FILES[@]}"; do - # Make paths relative to project root - local relative_path="${file#$PROJECT_DIR/}" - echo " - $relative_path" - done - else - # Normal installation with output - create_agent_os_folder - echo "" - - install_standards - echo "" - - # Install Claude Code files if enabled - if [[ "$EFFECTIVE_CLAUDE_CODE_COMMANDS" == "true" ]]; then - if [[ "$EFFECTIVE_USE_CLAUDE_CODE_SUBAGENTS" == "true" ]]; then - install_claude_code_commands_with_delegation - echo "" - install_claude_code_agents - echo "" - else - install_claude_code_commands_without_delegation - echo "" + return 1 + } + + # First, handle root-level .md files (not in subfolders) + local root_files=$(find "$standards_dir" -maxdepth 1 -name "*.md" -type f 2>/dev/null | sort) + if [[ -n "$root_files" ]]; then + echo "root:" >> "$temp_file" + while IFS= read -r file; do + local filename=$(basename "$file" .md) + local desc=$(get_existing_description "root" "$filename") + if [[ -z "$desc" ]]; then + desc="Needs description - run /index-standards" + ((new_count++)) fi - install_claude_code_skills - install_improve_skills_command - echo "" - fi + echo " $filename:" >> "$temp_file" + echo " description: $desc" >> "$temp_file" + ((entry_count++)) + done <<< "$root_files" + echo "" >> "$temp_file" + fi - # Install agent-os commands if enabled - if [[ "$EFFECTIVE_AGENT_OS_COMMANDS" == "true" ]]; then - install_agent_os_commands - echo "" + # Then handle files in subfolders + local folders=$(find "$standards_dir" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | sort) + for folder in $folders; do + local folder_name=$(basename "$folder") + local md_files=$(find "$folder" -name "*.md" -type f 2>/dev/null | sort) + + if [[ -n "$md_files" ]]; then + echo "$folder_name:" >> "$temp_file" + while IFS= read -r file; do + local filename=$(basename "$file" .md) + local desc=$(get_existing_description "$folder_name" "$filename") + if [[ -z "$desc" ]]; then + desc="Needs description - run /index-standards" + ((new_count++)) + fi + echo " $filename:" >> "$temp_file" + echo " description: $desc" >> "$temp_file" + ((entry_count++)) + done <<< "$md_files" + echo "" >> "$temp_file" fi - fi + done - if [[ "$DRY_RUN" == "true" ]]; then - echo "" - read -p "Proceed with actual installation? (y/n): " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]]; then - DRY_RUN="false" - INSTALLED_FILES=() - perform_installation + # Move temp file to final location + mv "$temp_file" "$index_file" + + if [[ "$entry_count" -gt 0 ]]; then + if [[ "$new_count" -gt 0 ]]; then + print_success "Updated index.yml ($entry_count entries, $new_count new)" + else + print_success "Updated index.yml ($entry_count entries)" fi else - print_success "Agent OS has been successfully installed in your project!" - echo "" - echo -e "${GREEN}Visit the docs for guides on how to use Agent OS: https://buildermethods.com/agent-os${NC}" - echo "" + print_success "Created index.yml (no standards to index)" fi } -# Handle re-installation -handle_reinstallation() { - print_section "Re-installation" - - print_warning "This will DELETE your current agent-os/ folder and reinstall from scratch." +install_commands() { echo "" + print_status "Installing commands..." - # Check for Claude Code files - if [[ -d "$PROJECT_DIR/.claude/agents/agent-os" ]] || [[ -d "$PROJECT_DIR/.claude/commands/agent-os" ]]; then - print_warning "This will also DELETE:" - [[ -d "$PROJECT_DIR/.claude/agents/agent-os" ]] && echo " - .claude/agents/agent-os/" - [[ -d "$PROJECT_DIR/.claude/commands/agent-os" ]] && echo " - .claude/commands/agent-os/" - echo "" - fi + local commands_source="$BASE_DIR/commands/agent-os" + local commands_dest="$PROJECT_DIR/.claude/commands/agent-os" - read -p "Are you sure you want to proceed? (y/n): " -n 1 -r - echo - if [[ ! $REPLY =~ ^[Yy]$ ]]; then - print_status "Re-installation cancelled" - exit 0 + if [[ ! -d "$commands_source" ]]; then + print_warning "No commands found in base installation" + return fi - if [[ "$DRY_RUN" != "true" ]]; then - print_status "Removing existing installation..." - rm -rf "$PROJECT_DIR/agent-os" - rm -rf "$PROJECT_DIR/.claude/agents/agent-os" - rm -rf "$PROJECT_DIR/.claude/commands/agent-os" - echo "βœ“ Existing installation removed" - echo "" - fi + ensure_dir "$commands_dest" - perform_installation + local count=0 + for file in "$commands_source"/*.md; do + if [[ -f "$file" ]]; then + cp "$file" "$commands_dest/" + ((count++)) + fi + done + + if [[ "$count" -gt 0 ]]; then + print_success "Installed $count commands to .claude/commands/agent-os/" + else + print_warning "No command files found" + fi } # ----------------------------------------------------------------------------- @@ -523,31 +417,60 @@ handle_reinstallation() { main() { print_section "Agent OS Project Installation" - # Parse command line arguments + # Parse arguments parse_arguments "$@" - # Check if we're trying to install in the base installation directory - check_not_base_installation - - # Validate base installation using common function + # Validations + validate_not_in_base validate_base_installation # Load configuration load_configuration - # Check if Agent OS is already installed - if is_agent_os_installed "$PROJECT_DIR"; then - if [[ "$RE_INSTALL" == "true" ]]; then - handle_reinstallation + # Show configuration + echo "" + print_status "Configuration:" + + # Display inheritance chain + local chain_depth=0 + local chain_display="" + # Read chain in reverse order (from requested profile back to base) for display + local reversed_chain=$(echo "$INHERITANCE_CHAIN" | tac) + while IFS= read -r profile_name; do + [[ -z "$profile_name" ]] && continue + if [[ "$chain_depth" -eq 0 ]]; then + chain_display=" Profile: $profile_name" else - # Delegate to update script - print_status "Agent OS is already installed. Running update..." - exec "$BASE_DIR/scripts/project-update.sh" "$@" + local indent="" + for ((i=0; i /dev/null - fi - fi - fi - fi - done < <(get_profile_files "$PROJECT_PROFILE" "$BASE_DIR" "standards") - - if [[ "$DRY_RUN" != "true" ]]; then - if [[ $standards_new -gt 0 ]]; then - echo "βœ“ Added $standards_new standards in agent-os/standards" - fi - if [[ $standards_updated -gt 0 ]]; then - echo "βœ“ Updated $standards_updated standards in agent-os/standards" - fi - if [[ $standards_skipped -gt 0 ]]; then - echo -e "${YELLOW}$standards_skipped files in agent-os/standards were not updated and overwritten. To update and overwrite these, re-run with --overwrite-standards flag.${NC}" - fi - fi -} - -# Update single-agent commands -update_single_agent_commands() { - print_status "Updating single-agent commands..." - local commands_updated=0 - local commands_skipped=0 - local commands_new=0 - - while read file; do - # Process single-agent command files OR orchestrate-tasks special case - if [[ "$file" == commands/*/single-agent/* ]] || [[ "$file" == commands/orchestrate-tasks/orchestrate-tasks.md ]]; then - local source=$(get_profile_file "$PROJECT_PROFILE" "$file" "$BASE_DIR") - if [[ -f "$source" ]]; then - # Handle orchestrate-tasks specially (preserve folder structure) - if [[ "$file" == commands/orchestrate-tasks/orchestrate-tasks.md ]]; then - local dest="$PROJECT_DIR/agent-os/commands/orchestrate-tasks/orchestrate-tasks.md" - else - # Strip the single-agent/ subfolder for agent-os/commands structure - local dest_file=$(echo "$file" | sed 's/\/single-agent//') - local dest="$PROJECT_DIR/agent-os/$dest_file" - fi - - if should_skip_file "$dest" "$OVERWRITE_ALL" "$OVERWRITE_COMMANDS" "command"; then - SKIPPED_FILES+=("$dest") - ((commands_skipped++)) || true - print_verbose "Skipped: $dest" - else - if [[ -f "$dest" ]]; then - UPDATED_FILES+=("$dest") - ((commands_updated++)) || true - print_verbose "Updated: $dest" - else - NEW_FILES+=("$dest") - ((commands_new++)) || true - print_verbose "New file: $dest" - fi - if [[ "$DRY_RUN" != "true" ]]; then - # Compile with PHASE embedding (mode="embed") - compile_command "$source" "$dest" "$BASE_DIR" "$PROJECT_PROFILE" "embed" - fi - fi - fi - fi - done < <(get_profile_files "$PROJECT_PROFILE" "$BASE_DIR" "commands") - - if [[ "$DRY_RUN" != "true" ]]; then - if [[ $commands_new -gt 0 ]]; then - echo "βœ“ Added $commands_new single-agent commands" - fi - if [[ $commands_updated -gt 0 ]]; then - echo "βœ“ Updated $commands_updated single-agent commands" - fi - if [[ $commands_skipped -gt 0 ]]; then - echo -e "${YELLOW}$commands_skipped commands were not updated and overwritten. To update and overwrite these, re-run with --overwrite-commands flag.${NC}" - fi - fi -} - -# Update Claude Code agents and commands -update_claude_code_files() { - print_status "Updating Claude Code tools" - - local commands_updated=0 - local commands_skipped=0 - local commands_new=0 - local agents_updated=0 - local agents_skipped=0 - local agents_new=0 - - # Update commands in .claude/commands/agent-os/ - # Determine which command mode to use based on subagents setting - if [[ "$PROJECT_USE_CLAUDE_CODE_SUBAGENTS" == "true" ]]; then - # Process multi-agent command files - while read file; do - if [[ "$file" == commands/*/multi-agent/* ]] || [[ "$file" == commands/orchestrate-tasks/orchestrate-tasks.md ]]; then - local source=$(get_profile_file "$PROJECT_PROFILE" "$file" "$BASE_DIR") - if [[ -f "$source" ]]; then - # Extract command name - if [[ "$file" == commands/orchestrate-tasks/orchestrate-tasks.md ]]; then - local command_name="orchestrate-tasks" - else - local command_name=$(echo "$file" | sed 's/commands\///' | sed 's/\/multi-agent.*//') - fi - local dest="$PROJECT_DIR/.claude/commands/agent-os/${command_name}.md" - - if should_skip_file "$dest" "$OVERWRITE_ALL" "$OVERWRITE_COMMANDS" "command"; then - SKIPPED_FILES+=("$dest") - ((commands_skipped++)) || true - print_verbose "Skipped: $dest" - else - if [[ -f "$dest" ]]; then - UPDATED_FILES+=("$dest") - ((commands_updated++)) || true - print_verbose "Updated: $dest" - else - NEW_FILES+=("$dest") - ((commands_new++)) || true - print_verbose "New file: $dest" - fi - if [[ "$DRY_RUN" != "true" ]]; then - # Compile with workflow and standards injection (includes conditional compilation) - compile_command "$source" "$dest" "$BASE_DIR" "$PROJECT_PROFILE" "" - fi - fi - fi - fi - done < <(get_profile_files "$PROJECT_PROFILE" "$BASE_DIR" "commands") - else - # Process single-agent command files (only non-numbered files, with PHASE embedding) - while read file; do - if [[ "$file" == commands/*/single-agent/* ]] || [[ "$file" == commands/orchestrate-tasks/orchestrate-tasks.md ]]; then - local source=$(get_profile_file "$PROJECT_PROFILE" "$file" "$BASE_DIR") - if [[ -f "$source" ]]; then - # Handle orchestrate-tasks specially - if [[ "$file" == commands/orchestrate-tasks/orchestrate-tasks.md ]]; then - local dest="$PROJECT_DIR/.claude/commands/agent-os/orchestrate-tasks.md" - - if should_skip_file "$dest" "$OVERWRITE_ALL" "$OVERWRITE_COMMANDS" "command"; then - SKIPPED_FILES+=("$dest") - ((commands_skipped++)) || true - print_verbose "Skipped: $dest" - else - if [[ -f "$dest" ]]; then - UPDATED_FILES+=("$dest") - ((commands_updated++)) || true - print_verbose "Updated: $dest" - else - NEW_FILES+=("$dest") - ((commands_new++)) || true - print_verbose "New file: $dest" - fi - if [[ "$DRY_RUN" != "true" ]]; then - compile_command "$source" "$dest" "$BASE_DIR" "$PROJECT_PROFILE" "" - fi - fi - else - # Only process non-numbered files - local filename=$(basename "$file") - if [[ ! "$filename" =~ ^[0-9]+-.*\.md$ ]]; then - local cmd_name=$(echo "$file" | sed 's|commands/\([^/]*\)/single-agent/.*|\1|') - local dest="$PROJECT_DIR/.claude/commands/agent-os/$cmd_name.md" - - if should_skip_file "$dest" "$OVERWRITE_ALL" "$OVERWRITE_COMMANDS" "command"; then - SKIPPED_FILES+=("$dest") - ((commands_skipped++)) || true - print_verbose "Skipped: $dest" - else - if [[ -f "$dest" ]]; then - UPDATED_FILES+=("$dest") - ((commands_updated++)) || true - print_verbose "Updated: $dest" - else - NEW_FILES+=("$dest") - ((commands_new++)) || true - print_verbose "New file: $dest" - fi - if [[ "$DRY_RUN" != "true" ]]; then - # Compile with PHASE embedding (mode="embed") - compile_command "$source" "$dest" "$BASE_DIR" "$PROJECT_PROFILE" "embed" - fi - fi - fi - fi - fi - fi - done < <(get_profile_files "$PROJECT_PROFILE" "$BASE_DIR" "commands") - fi - - # Update static agents - get_profile_files "$PROJECT_PROFILE" "$BASE_DIR" "agents" | while read file; do - if [[ "$file" == agents/*.md ]] && [[ "$file" != agents/templates/* ]]; then - local source=$(get_profile_file "$PROJECT_PROFILE" "$file" "$BASE_DIR") - if [[ -f "$source" ]]; then - local agent_name=$(basename "$file" .md) - local dest="$PROJECT_DIR/.claude/agents/agent-os/${agent_name}.md" - - if should_skip_file "$dest" "$OVERWRITE_ALL" "$OVERWRITE_AGENTS" "agent"; then - SKIPPED_FILES+=("$dest") - print_verbose "Skipped: $dest" - else - if [[ -f "$dest" ]]; then - UPDATED_FILES+=("$dest") - print_verbose "Updated: $dest" - else - NEW_FILES+=("$dest") - print_verbose "New file: $dest" - fi - if [[ "$DRY_RUN" != "true" ]]; then - compile_agent "$source" "$dest" "$BASE_DIR" "$PROJECT_PROFILE" "" - fi - fi - fi - fi - done - - # Update specification agents - get_profile_files "$PROJECT_PROFILE" "$BASE_DIR" "agents/specification" | while read file; do - if [[ "$file" == agents/specification/*.md ]]; then - local source=$(get_profile_file "$PROJECT_PROFILE" "$file" "$BASE_DIR") - if [[ -f "$source" ]]; then - local agent_name=$(basename "$file" .md) - local dest="$PROJECT_DIR/.claude/agents/agent-os/${agent_name}.md" - - if should_skip_file "$dest" "$OVERWRITE_ALL" "$OVERWRITE_AGENTS" "agent"; then - SKIPPED_FILES+=("$dest") - print_verbose "Skipped: $dest" - else - if [[ -f "$dest" ]]; then - UPDATED_FILES+=("$dest") - print_verbose "Updated: $dest" - else - NEW_FILES+=("$dest") - print_verbose "New file: $dest" - fi - if [[ "$DRY_RUN" != "true" ]]; then - compile_agent "$source" "$dest" "$BASE_DIR" "$PROJECT_PROFILE" "" - fi - fi - fi - fi - done - - if [[ "$DRY_RUN" != "true" ]]; then - # Count commands separately - local command_pattern=".claude/commands/agent-os" - local commands_actual_updated=0 - local commands_actual_skipped=0 - local commands_actual_new=0 - - for file in "${UPDATED_FILES[@]}"; do - [[ "$file" == *"$command_pattern"* ]] && ((commands_actual_updated++)) || true - done - - for file in "${NEW_FILES[@]}"; do - [[ "$file" == *"$command_pattern"* ]] && ((commands_actual_new++)) || true - done - - for file in "${SKIPPED_FILES[@]}"; do - [[ "$file" == *"$command_pattern"* ]] && ((commands_actual_skipped++)) || true - done - - if [[ $commands_actual_new -gt 0 ]]; then - echo "βœ“ Added $commands_actual_new Claude Code commands" - fi - if [[ $commands_actual_updated -gt 0 ]]; then - echo "βœ“ Updated $commands_actual_updated Claude Code commands" - fi - if [[ $commands_actual_skipped -gt 0 ]]; then - echo -e "${YELLOW}$commands_actual_skipped commands were not updated and overwritten. To update and overwrite these, re-run with --overwrite-commands flag.${NC}" - fi - - # Count agent files by checking SKIPPED_FILES, UPDATED_FILES, NEW_FILES - local agent_pattern=".claude/agents/agent-os" - local agents_updated=0 - local agents_skipped=0 - local agents_new=0 - - for file in "${UPDATED_FILES[@]}"; do - [[ "$file" == *"$agent_pattern"* ]] && ((agents_updated++)) || true - done - - for file in "${NEW_FILES[@]}"; do - [[ "$file" == *"$agent_pattern"* ]] && ((agents_new++)) || true - done - - for file in "${SKIPPED_FILES[@]}"; do - [[ "$file" == *"$agent_pattern"* ]] && ((agents_skipped++)) || true - done - - if [[ $agents_new -gt 0 ]]; then - echo "βœ“ Added $agents_new Claude Code agents" - fi - if [[ $agents_updated -gt 0 ]]; then - echo "βœ“ Updated $agents_updated Claude Code agents" - fi - if [[ $agents_skipped -gt 0 ]]; then - echo -e "${YELLOW}$agents_skipped agents were not updated and overwritten. To update and overwrite these, re-run with --overwrite-agents flag.${NC}" - fi - fi -} - -# Update agent-os folder and configuration -update_agent_os_folder() { - print_status "Updating agent-os folder" - - # Update the configuration file - write_project_config "$EFFECTIVE_VERSION" "$PROJECT_PROFILE" \ - "$PROJECT_CLAUDE_CODE_COMMANDS" "$PROJECT_USE_CLAUDE_CODE_SUBAGENTS" \ - "$PROJECT_AGENT_OS_COMMANDS" "$PROJECT_STANDARDS_AS_CLAUDE_CODE_SKILLS" - - if [[ "$DRY_RUN" != "true" ]]; then - echo "βœ“ Updated agent-os folder" - echo "βœ“ Updated agent-os project configuration" - fi -} - -# Perform update -perform_update() { - # Display configuration at the top - echo "" - print_status "Configuration:" - echo -e " Profile: ${YELLOW}$PROJECT_PROFILE${NC}" - echo -e " Claude Code commands: ${YELLOW}$PROJECT_CLAUDE_CODE_COMMANDS${NC}" - echo -e " Use Claude Code subagents: ${YELLOW}$PROJECT_USE_CLAUDE_CODE_SUBAGENTS${NC}" - echo -e " Standards as Claude Code Skills: ${YELLOW}$PROJECT_STANDARDS_AS_CLAUDE_CODE_SKILLS${NC}" - echo -e " Agent OS commands: ${YELLOW}$PROJECT_AGENT_OS_COMMANDS${NC}" - echo "" - - # Update agent-os folder and configuration - update_agent_os_folder - echo "" - - # Update components based on enabled flags - update_standards - echo "" - - # Update Claude Code files if enabled - if [[ "$PROJECT_CLAUDE_CODE_COMMANDS" == "true" ]]; then - if [[ "$PROJECT_USE_CLAUDE_CODE_SUBAGENTS" == "true" ]]; then - update_claude_code_files - echo "" - else - # Update commands without delegation - # TODO: Need to implement this update function - update_claude_code_files - echo "" - fi - # Install/update Claude Code Skills (uses install function since directory was cleaned) - install_claude_code_skills - install_improve_skills_command - echo "" - fi - - # Update agent-os commands if enabled - if [[ "$PROJECT_AGENT_OS_COMMANDS" == "true" ]]; then - update_single_agent_commands - echo "" - fi - - if [[ "$DRY_RUN" == "true" ]]; then - print_warning "DRY RUN - No files were actually modified" - echo "" - - if [[ ${#NEW_FILES[@]} -gt 0 ]]; then - print_status "New files that would be added:" - for file in "${NEW_FILES[@]}"; do - echo " + $file" - done - echo "" - fi - - if [[ ${#UPDATED_FILES[@]} -gt 0 ]]; then - print_status "Files that would be updated:" - for file in "${UPDATED_FILES[@]}"; do - echo " ~ $file" - done - echo "" - fi - - if [[ ${#SKIPPED_FILES[@]} -gt 0 ]]; then - print_status "Files that would be skipped:" - for file in "${SKIPPED_FILES[@]}"; do - echo " - $file" - done - echo "" - fi - - read -p "Proceed with actual update? (y/n): " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]]; then - DRY_RUN="false" - SKIPPED_FILES=() - UPDATED_FILES=() - NEW_FILES=() - perform_update - fi - else - print_success "Agent OS has been successfully updated!" - echo "" - echo -e "${GREEN}Visit the docs for guides on how to use Agent OS: https://buildermethods.com/agent-os${NC}" - echo "" - fi -} - -# Handle re-installation - -# Handle recompilation with new config - -# ----------------------------------------------------------------------------- -# Migration Functions for v2.1.0 -# ----------------------------------------------------------------------------- - -# Prompt user for update/migration - unified for all scenarios -prompt_update_confirmation() { - local current_version=$1 - local has_version_diff=$2 - local has_config_diff=$3 - - local target_version="$BASE_VERSION" - - # Determine if there are differences - if [[ "$has_version_diff" == "true" ]] || [[ "$has_config_diff" == "true" ]]; then - echo "" - print_color "$PURPLE" "=== Version/Configuration Update Required ===" - echo "" - if [[ "$DRY_RUN" == "true" ]]; then - print_warning "Dry run simulation" - fi - echo "" - print_status "Your project's Agent OS version and/or configuration is different than the version you're trying to install." - else - echo "" - print_color "$PURPLE" "=== Confirm Update ===" - echo "" - if [[ "$DRY_RUN" == "true" ]]; then - print_warning "Dry run simulation" - fi - echo "" - if [[ "$DRY_RUN" == "true" ]]; then - print_status "Confirm you'd like to proceed with a DRY RUN update simulation." - else - print_status "Confirm you'd like to proceed with an update." - fi - fi - echo "" - - # Display current project config - print_status "Current project's Agent OS:" - if [[ -n "$current_version" ]]; then - echo " Version: $current_version" - else - echo " Version: (not specified)" - fi - - # Show old config values if they exist - if [[ -n "${MULTI_AGENT_MODE:-}" ]] || [[ -n "${SINGLE_AGENT_MODE:-}" ]] || [[ -n "${MULTI_AGENT_TOOL:-}" ]]; then - echo " Config format: Legacy (multi_agent_mode, single_agent_mode, multi_agent_tool)" - elif [[ -n "$PROJECT_CLAUDE_CODE_COMMANDS" ]]; then - echo " Profile: ${PROJECT_PROFILE:-default}" - echo " Claude Code commands: ${PROJECT_CLAUDE_CODE_COMMANDS:-false}" - echo " Use Claude Code subagents: ${PROJECT_USE_CLAUDE_CODE_SUBAGENTS:-false}" - echo " Agent OS commands: ${PROJECT_AGENT_OS_COMMANDS:-false}" - echo " Standards as Claude Code Skills: ${PROJECT_STANDARDS_AS_CLAUDE_CODE_SKILLS:-false}" - else - echo " Config: Unable to read current configuration" - fi - echo "" - - # Display incoming config - print_status "Incoming Agent OS:" - echo " Version: $target_version" - echo " Profile: $EFFECTIVE_PROFILE" - echo " Claude Code commands: $EFFECTIVE_CLAUDE_CODE_COMMANDS" - echo " Use Claude Code subagents: $EFFECTIVE_USE_CLAUDE_CODE_SUBAGENTS" - echo " Agent OS commands: $EFFECTIVE_AGENT_OS_COMMANDS" - echo " Standards as Claude Code Skills: $EFFECTIVE_STANDARDS_AS_CLAUDE_CODE_SKILLS" - echo "" - - # Show what will happen - if [[ "$DRY_RUN" == "true" ]]; then - print_status "Here's what WOULD happen if this were a real update (but it's a DRY RUN):" - else - print_status "Here's what will happen if you proceed:" - fi - echo "" - echo -e "${GREEN}βœ” These will remain intact:${NC}" - echo "" - echo " - agent-os/specs/*" - echo " - agent-os/product/*" - echo "" - if [[ "$DRY_RUN" == "true" ]]; then - echo -e "${YELLOW}⚠️ These WOULD BE deleted and re-installed to match the new version and configurations if this were a real update (but it's a DRY RUN):${NC}" - else - echo -e "${YELLOW}⚠️ These will be deleted and re-installed to match the new version and configurations:${NC}" - fi - echo "" - echo " - agent-os/config.yml" - echo " - agent-os/standards/" - if [[ "$EFFECTIVE_AGENT_OS_COMMANDS" == "true" ]] || [[ -d "$PROJECT_DIR/agent-os/commands" ]]; then - echo " - agent-os/commands/" - fi - if [[ "$EFFECTIVE_USE_CLAUDE_CODE_SUBAGENTS" == "true" ]] || [[ -d "$PROJECT_DIR/.claude/agents/agent-os" ]]; then - echo " - .claude/agents/agent-os/" - fi - if [[ "$EFFECTIVE_CLAUDE_CODE_COMMANDS" == "true" ]] || [[ -d "$PROJECT_DIR/.claude/commands/agent-os" ]]; then - echo " - .claude/commands/agent-os/" - fi - if [[ "$EFFECTIVE_STANDARDS_AS_CLAUDE_CODE_SKILLS" == "true" ]] || [[ -d "$PROJECT_DIR/.claude/skills" ]]; then - echo " - .claude/skills/ (Agent OS skills)" - fi - echo "" - - read -p "Do you want to proceed? (y/n): " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]]; then - return 0 # user confirmed - else - return 1 # user declined - fi -} - -# Perform cleanup before update - delete everything except specs/ and product/ -perform_update_cleanup() { - if [[ "$DRY_RUN" == "true" ]]; then - print_warning "Dry run: Would prepare for update..." - echo "" - else - print_status "Preparing for update..." - echo "" - fi - - # Delete agent-os/standards/ (will be reinstalled) - if [[ -d "$PROJECT_DIR/agent-os/standards" ]]; then - print_status "Removing agent-os/standards/" - if [[ "$DRY_RUN" != "true" ]]; then - rm -rf "$PROJECT_DIR/agent-os/standards" - fi - fi - - # Delete agent-os/commands/ if exists - if [[ -d "$PROJECT_DIR/agent-os/commands" ]]; then - print_status "Removing agent-os/commands/" - if [[ "$DRY_RUN" != "true" ]]; then - rm -rf "$PROJECT_DIR/agent-os/commands" - fi - fi - - # Delete .claude/agents/agent-os/ if exists - if [[ -d "$PROJECT_DIR/.claude/agents/agent-os" ]]; then - print_status "Removing .claude/agents/agent-os/" - if [[ "$DRY_RUN" != "true" ]]; then - rm -rf "$PROJECT_DIR/.claude/agents/agent-os" - fi - fi - - # Delete .claude/commands/agent-os/ if exists - if [[ -d "$PROJECT_DIR/.claude/commands/agent-os" ]]; then - print_status "Removing .claude/commands/agent-os/" - if [[ "$DRY_RUN" != "true" ]]; then - rm -rf "$PROJECT_DIR/.claude/commands/agent-os" - fi - fi - - # Delete old .claude/skills/agent-os/ if exists (legacy location) - if [[ -d "$PROJECT_DIR/.claude/skills/agent-os" ]]; then - print_status "Removing legacy .claude/skills/agent-os/" - if [[ "$DRY_RUN" != "true" ]]; then - rm -rf "$PROJECT_DIR/.claude/skills/agent-os" - fi - fi - - # Delete individual Agent OS skills (new location: .claude/skills/[skill-name]/) - # Find all skills that match standards files from the profile - if [[ -d "$PROJECT_DIR/.claude/skills" ]]; then - while read file; do - if [[ "$file" == standards/* ]] && [[ "$file" == *.md ]]; then - local skill_name=$(echo "$file" | sed 's|^standards/||' | sed 's|\.md$||' | sed 's|/|-|g') - if [[ -d "$PROJECT_DIR/.claude/skills/$skill_name" ]]; then - print_status "Removing .claude/skills/$skill_name/" - if [[ "$DRY_RUN" != "true" ]]; then - rm -rf "$PROJECT_DIR/.claude/skills/$skill_name" - fi - fi - fi - done < <(get_profile_files "$PROJECT_PROFILE" "$BASE_DIR" "standards") - fi - - # Delete agent-os/roles/ if exists (legacy) - if [[ -d "$PROJECT_DIR/agent-os/roles" ]]; then - print_status "Removing legacy agent-os/roles/" - if [[ "$DRY_RUN" != "true" ]]; then - rm -rf "$PROJECT_DIR/agent-os/roles" - fi - fi - - echo "" - if [[ "$DRY_RUN" == "true" ]]; then - print_success "Dry run: Cleanup would be complete!" - else - print_success "Cleanup complete!" - fi - echo "" - print_status "Proceeding with update..." - echo "" -} - -# ----------------------------------------------------------------------------- -# Main Execution -# ----------------------------------------------------------------------------- - -main() { - # Parse command line arguments - parse_arguments "$@" - - # Check if we're trying to update in the base installation directory - check_not_base_installation - - # Validate installations - validate_installations - - # Load configurations - load_configurations - - # Check for version differences - local has_version_diff="false" - if [[ "$PROJECT_VERSION" != "$BASE_VERSION" ]] || check_needs_migration "$PROJECT_VERSION"; then - has_version_diff="true" - fi - - # Check for config differences - local has_config_diff="false" - if [[ "$PROJECT_PROFILE" != "$EFFECTIVE_PROFILE" ]] || \ - [[ "$PROJECT_CLAUDE_CODE_COMMANDS" != "$EFFECTIVE_CLAUDE_CODE_COMMANDS" ]] || \ - [[ "$PROJECT_USE_CLAUDE_CODE_SUBAGENTS" != "$EFFECTIVE_USE_CLAUDE_CODE_SUBAGENTS" ]] || \ - [[ "$PROJECT_AGENT_OS_COMMANDS" != "$EFFECTIVE_AGENT_OS_COMMANDS" ]] || \ - [[ "$PROJECT_STANDARDS_AS_CLAUDE_CODE_SKILLS" != "$EFFECTIVE_STANDARDS_AS_CLAUDE_CODE_SKILLS" ]]; then - has_config_diff="true" - fi - - # Always prompt for confirmation (whether there are differences or not) - if prompt_update_confirmation "$PROJECT_VERSION" "$has_version_diff" "$has_config_diff"; then - # User confirmed - show any config validation warnings - echo "" - validate_config "$EFFECTIVE_CLAUDE_CODE_COMMANDS" "$EFFECTIVE_USE_CLAUDE_CODE_SUBAGENTS" "$EFFECTIVE_AGENT_OS_COMMANDS" "$EFFECTIVE_STANDARDS_AS_CLAUDE_CODE_SKILLS" "$EFFECTIVE_PROFILE" "true" - echo "" - - # Perform cleanup and update - perform_update_cleanup - - # Set PROJECT_* variables to match EFFECTIVE_* for perform_update to use - PROJECT_PROFILE="$EFFECTIVE_PROFILE" - PROJECT_CLAUDE_CODE_COMMANDS="$EFFECTIVE_CLAUDE_CODE_COMMANDS" - PROJECT_USE_CLAUDE_CODE_SUBAGENTS="$EFFECTIVE_USE_CLAUDE_CODE_SUBAGENTS" - PROJECT_AGENT_OS_COMMANDS="$EFFECTIVE_AGENT_OS_COMMANDS" - PROJECT_STANDARDS_AS_CLAUDE_CODE_SKILLS="$EFFECTIVE_STANDARDS_AS_CLAUDE_CODE_SKILLS" - - # Proceed with update - perform_update - exit 0 - else - print_status "Update cancelled by user" - exit 0 - fi -} - -# Run main function -main "$@" diff --git a/scripts/sync-to-profile.sh b/scripts/sync-to-profile.sh new file mode 100755 index 00000000..0f1a7b07 --- /dev/null +++ b/scripts/sync-to-profile.sh @@ -0,0 +1,528 @@ +#!/bin/bash + +# ============================================================================= +# Agent OS Sync to Profile Script +# Syncs project standards back to a base profile for reuse +# ============================================================================= + +set -e + +# Get the directory where this script is located +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +BASE_DIR="$(dirname "$SCRIPT_DIR")" +PROJECT_DIR="$(pwd)" + +# Source common functions +source "$SCRIPT_DIR/common-functions.sh" + +# ----------------------------------------------------------------------------- +# Default Values +# ----------------------------------------------------------------------------- + +VERBOSE="false" +PROFILE="" +NEW_PROFILE="" +SYNC_ALL="false" +OVERWRITE="false" + +# Arrays for file handling +declare -a STANDARDS_FILES +declare -a SELECTED_FILES + +# ----------------------------------------------------------------------------- +# Help Function +# ----------------------------------------------------------------------------- + +show_help() { + cat << EOF +Usage: $0 [OPTIONS] + +Sync project standards back to a base profile for reuse. + +Options: + --profile Target profile (skips selection prompt) + --new-profile Create a new profile with these standards + --all Sync all standards (skips file selection) + --overwrite Overwrite existing files without prompting + --verbose Show detailed output + -h, --help Show this help message + +Examples: + $0 + $0 --profile rails + $0 --all --overwrite + $0 --new-profile nextjs --all + +EOF + exit 0 +} + +# ----------------------------------------------------------------------------- +# Parse Command Line Arguments +# ----------------------------------------------------------------------------- + +parse_arguments() { + while [[ $# -gt 0 ]]; do + case $1 in + --profile) + PROFILE="$2" + shift 2 + ;; + --new-profile) + NEW_PROFILE="$2" + shift 2 + ;; + --all) + SYNC_ALL="true" + shift + ;; + --overwrite) + OVERWRITE="true" + shift + ;; + --verbose) + VERBOSE="true" + shift + ;; + -h|--help) + show_help + ;; + *) + print_error "Unknown option: $1" + show_help + ;; + esac + done +} + +# ----------------------------------------------------------------------------- +# Validation Functions +# ----------------------------------------------------------------------------- + +validate_base_installation() { + if [[ ! -d "$BASE_DIR" ]]; then + print_error "Agent OS base installation not found" + exit 1 + fi + + if [[ ! -d "$BASE_DIR/profiles" ]]; then + print_error "No profiles directory in base installation" + exit 1 + fi +} + +validate_project_standards() { + local standards_dir="$PROJECT_DIR/agent-os/standards" + + if [[ ! -d "$standards_dir" ]]; then + print_error "No standards directory found at agent-os/standards/" + echo "" + echo "Run project-install.sh first to set up Agent OS in this project." + exit 1 + fi +} + +# ----------------------------------------------------------------------------- +# Standards Discovery +# ----------------------------------------------------------------------------- + +find_standards_files() { + local standards_dir="$PROJECT_DIR/agent-os/standards" + STANDARDS_FILES=() + + # Find all .md files, excluding .backups directory + while IFS= read -r -d '' file; do + local relative_path="${file#$standards_dir/}" + STANDARDS_FILES+=("$relative_path") + done < <(find "$standards_dir" -name "*.md" -type f ! -path "*/.backups/*" -print0 2>/dev/null | sort -z) + + if [[ ${#STANDARDS_FILES[@]} -eq 0 ]]; then + print_error "No standards to sync." + echo "" + echo "Create standards first using /discover-standards or manually." + exit 1 + fi + + print_verbose "Found ${#STANDARDS_FILES[@]} standards files" +} + +# ----------------------------------------------------------------------------- +# Profile Selection +# ----------------------------------------------------------------------------- + +list_existing_profiles() { + local profiles=() + for dir in "$BASE_DIR/profiles"/*/; do + if [[ -d "$dir" ]]; then + local name=$(basename "$dir") + profiles+=("$name") + fi + done + echo "${profiles[@]}" +} + +select_profile() { + # If --new-profile was specified, use that + if [[ -n "$NEW_PROFILE" ]]; then + PROFILE="$NEW_PROFILE" + create_profile_if_needed + return + fi + + # If --profile was specified, validate it + if [[ -n "$PROFILE" ]]; then + if [[ ! -d "$BASE_DIR/profiles/$PROFILE" ]]; then + echo "" + read -p "Profile '$PROFILE' doesn't exist. Create it? (y/n): " create_choice + if [[ "$create_choice" =~ ^[Yy] ]]; then + create_new_profile "$PROFILE" + else + print_error "Cancelled." + exit 1 + fi + fi + return + fi + + # Interactive profile selection + echo "" + print_status "Available profiles:" + echo "" + + local profiles=($(list_existing_profiles)) + local i=1 + + for profile in "${profiles[@]}"; do + echo " $i) $profile" + ((i++)) + done + echo " $i) [Create new profile]" + echo "" + + local max_choice=$i + local choice + + while true; do + read -p "Select profile (1-$max_choice): " choice + + if [[ "$choice" =~ ^[0-9]+$ ]] && [[ "$choice" -ge 1 ]] && [[ "$choice" -le "$max_choice" ]]; then + break + fi + echo "Invalid choice. Please enter a number between 1 and $max_choice." + done + + if [[ "$choice" -eq "$max_choice" ]]; then + # Create new profile + echo "" + read -p "Enter new profile name: " PROFILE + if [[ -z "$PROFILE" ]]; then + print_error "Profile name cannot be empty." + exit 1 + fi + create_new_profile "$PROFILE" + else + PROFILE="${profiles[$((choice-1))]}" + fi + + print_verbose "Selected profile: $PROFILE" +} + +create_profile_if_needed() { + if [[ ! -d "$BASE_DIR/profiles/$PROFILE" ]]; then + create_new_profile "$PROFILE" + fi +} + +create_new_profile() { + local name="$1" + local profile_dir="$BASE_DIR/profiles/$name" + + mkdir -p "$profile_dir/standards" + print_success "Created new profile: $name" +} + +# ----------------------------------------------------------------------------- +# File Selection +# ----------------------------------------------------------------------------- + +select_files() { + # If --all was specified, select all files + if [[ "$SYNC_ALL" == "true" ]]; then + SELECTED_FILES=("${STANDARDS_FILES[@]}") + print_verbose "Selected all ${#SELECTED_FILES[@]} files" + return + fi + + # Initialize selection array (all selected by default) + local selected=() + for ((i=0; i<${#STANDARDS_FILES[@]}; i++)); do + selected[$i]=1 + done + + # Calculate lines to clear (files + 5 for header/footer) + local lines_to_clear=$((${#STANDARDS_FILES[@]} + 7)) + + display_file_selection() { + echo "" + print_status "Select standards to sync:" + echo "" + local i=1 + for file in "${STANDARDS_FILES[@]}"; do + if [[ ${selected[$((i-1))]} -eq 1 ]]; then + echo " $i) [x] $file" + else + echo " $i) [ ] $file" + fi + ((i++)) + done + echo "" + echo "" + echo " Enter number to toggle a) All n) None d) Done" + echo "" + } + + clear_display() { + # Move cursor up and clear lines + for ((i=0; i/dev/null || echo -ne "\033[1A" + tput el 2>/dev/null || echo -ne "\033[2K" + done + } + + local first_display=true + + while true; do + if [[ "$first_display" == "true" ]]; then + first_display=false + else + clear_display + fi + + display_file_selection + read -p "Toggle (1-${#STANDARDS_FILES[@]}), a, n, or d: " choice + + case "$choice" in + a|A) + for ((i=0; i<${#STANDARDS_FILES[@]}; i++)); do + selected[$i]=1 + done + ;; + n|N) + for ((i=0; i<${#STANDARDS_FILES[@]}; i++)); do + selected[$i]=0 + done + ;; + d|D) + break + ;; + *) + if [[ "$choice" =~ ^[0-9]+$ ]] && [[ "$choice" -ge 1 ]] && [[ "$choice" -le ${#STANDARDS_FILES[@]} ]]; then + local idx=$((choice-1)) + if [[ ${selected[$idx]} -eq 1 ]]; then + selected[$idx]=0 + else + selected[$idx]=1 + fi + fi + # Invalid input just redisplays + ;; + esac + done + + # Build selected files array + SELECTED_FILES=() + for ((i=0; i<${#STANDARDS_FILES[@]}; i++)); do + if [[ ${selected[$i]} -eq 1 ]]; then + SELECTED_FILES+=("${STANDARDS_FILES[$i]}") + fi + done + + if [[ ${#SELECTED_FILES[@]} -eq 0 ]]; then + print_error "No files selected." + exit 1 + fi + + print_verbose "Selected ${#SELECTED_FILES[@]} files" +} + +# ----------------------------------------------------------------------------- +# Conflict Detection +# ----------------------------------------------------------------------------- + +check_conflicts() { + local profile_standards="$BASE_DIR/profiles/$PROFILE/standards" + local conflicts=() + + for file in "${SELECTED_FILES[@]}"; do + if [[ -f "$profile_standards/$file" ]]; then + conflicts+=("$file") + fi + done + + if [[ ${#conflicts[@]} -eq 0 ]]; then + return 0 + fi + + # If --overwrite specified, just backup and continue + if [[ "$OVERWRITE" == "true" ]]; then + backup_files "${conflicts[@]}" + return 0 + fi + + # Prompt user + echo "" + print_warning "${#conflicts[@]} file(s) already exist in profile '$PROFILE':" + for file in "${conflicts[@]}"; do + echo " - $file" + done + echo "" + + while true; do + echo "What do you want to do?" + echo " 1) Overwrite all (with backup)" + echo " 2) Skip existing files" + echo " 3) Cancel" + echo "" + read -p "Choice (1-3): " conflict_choice + + case "$conflict_choice" in + 1) + backup_files "${conflicts[@]}" + return 0 + ;; + 2) + # Remove conflicts from selected files + local new_selected=() + for file in "${SELECTED_FILES[@]}"; do + local is_conflict=false + for conflict in "${conflicts[@]}"; do + if [[ "$file" == "$conflict" ]]; then + is_conflict=true + break + fi + done + if [[ "$is_conflict" == "false" ]]; then + new_selected+=("$file") + fi + done + SELECTED_FILES=("${new_selected[@]}") + + if [[ ${#SELECTED_FILES[@]} -eq 0 ]]; then + print_warning "No files left to sync after skipping conflicts." + exit 0 + fi + return 0 + ;; + 3) + print_error "Cancelled." + exit 1 + ;; + *) + echo "Invalid choice." + ;; + esac + done +} + +# ----------------------------------------------------------------------------- +# Backup Functions +# ----------------------------------------------------------------------------- + +backup_files() { + local files=("$@") + + if [[ ${#files[@]} -eq 0 ]]; then + return + fi + + local profile_standards="$BASE_DIR/profiles/$PROFILE/standards" + local timestamp=$(date +"%Y-%m-%d-%H%M") + local backup_dir="$profile_standards/.backups/$timestamp" + + mkdir -p "$backup_dir" + + local backup_count=0 + for file in "${files[@]}"; do + local source_file="$profile_standards/$file" + local backup_file="$backup_dir/$file" + + if [[ -f "$source_file" ]]; then + mkdir -p "$(dirname "$backup_file")" + cp "$source_file" "$backup_file" + ((backup_count++)) + print_verbose "Backed up: $file" + fi + done + + if [[ "$backup_count" -gt 0 ]]; then + print_success "Backed up $backup_count file(s) to .backups/$timestamp/" + fi +} + +# ----------------------------------------------------------------------------- +# Sync Execution +# ----------------------------------------------------------------------------- + +execute_sync() { + local project_standards="$PROJECT_DIR/agent-os/standards" + local profile_standards="$BASE_DIR/profiles/$PROFILE/standards" + + local sync_count=0 + for file in "${SELECTED_FILES[@]}"; do + local source_file="$project_standards/$file" + local dest_file="$profile_standards/$file" + + # Create directory if needed + mkdir -p "$(dirname "$dest_file")" + + # Copy the file + cp "$source_file" "$dest_file" + ((sync_count++)) + print_verbose "Synced: $file" + done + + echo "" + print_success "Synced $sync_count file(s) to profile '$PROFILE'" +} + +# ----------------------------------------------------------------------------- +# Main Execution +# ----------------------------------------------------------------------------- + +main() { + print_section "Agent OS Sync to Profile" + + # Parse arguments + parse_arguments "$@" + + # Validations + validate_base_installation + validate_project_standards + + # Find standards files + find_standards_files + + # Select target profile + select_profile + + # Select files to sync + select_files + + # Show summary + echo "" + print_status "Sync summary:" + echo " Profile: $PROFILE" + echo " Files to sync: ${#SELECTED_FILES[@]}" + echo "" + + # Check for conflicts and handle them + check_conflicts + + # Execute sync + execute_sync + + echo "" +} + +# Run main function +main "$@" From 7b4b8bf673ea8f7251ddbb671b38709cb55e5b75 Mon Sep 17 00:00:00 2001 From: Brian Casel Date: Tue, 20 Jan 2026 12:17:18 -0500 Subject: [PATCH 05/12] updated readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9583888e..46bed995 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ agent-os-og -## Enhance your spec-driven development with smart standards. +## Agents that build the way you would -[Agent OS](https://buildermethods.com/agent-os) captures the tribal knowledge from your codebase and deploys it to your AI coding tools exactly when needed. Document your standards once, then let Agent OS inject the right conventions into the right contextβ€”so every spec and every implementation follows your patterns. +[Agent OS](https://buildermethods.com/agent-os) helps you shape better specs, keeps agents aligned in a lightweight system that fits how you already build. Works alongside Claude Code, Cursor, Antigravity, and other AI tools. Any language, any framework. From 809fb4e3e20451e3dd9ad9b253111776db373518 Mon Sep 17 00:00:00 2001 From: Brian Casel Date: Tue, 20 Jan 2026 12:18:24 -0500 Subject: [PATCH 06/12] Updated Agent OS image v3 branding --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 46bed995..78e2756d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -agent-os-og +Agent OS ## Agents that build the way you would @@ -38,3 +38,4 @@ Get Brian's free resources on building with AI: - [YouTube](https://youtube.com/@briancasel) Join [Builder Methods Pro](https://buildermethods.com/pro) for official support and connect with our community of AI-first builders: + From e3398eab7b64d37ca3d68129ebfd200b69ec6549 Mon Sep 17 00:00:00 2001 From: Brian Casel Date: Tue, 20 Jan 2026 13:12:00 -0500 Subject: [PATCH 07/12] fixed default config.yml --- config.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config.yml b/config.yml index 74817112..afb94a8f 100644 --- a/config.yml +++ b/config.yml @@ -1,10 +1,10 @@ version: 3.0 -default_profile: test-profile +default_profile: default # Optional: define inheritance relationships for profiles # Profiles not listed here still work, they just have no inheritance -profiles: - test-profile: - inherits_from: mid-profile - mid-profile: - inherits_from: base-profile +# profiles: +# profile-a: +# inherits_from: default +# profile-b: +# inherits_from: profile-a From 822af6545d4d806c1ba5e3d86ea56dd98f3a827d Mon Sep 17 00:00:00 2001 From: Brian Casel Date: Tue, 20 Jan 2026 16:50:36 -0500 Subject: [PATCH 08/12] Improved discover-standards Q&A workflow --- commands/agent-os/discover-standards.md | 94 ++++++++++++++++++++++--- 1 file changed, 84 insertions(+), 10 deletions(-) diff --git a/commands/agent-os/discover-standards.md b/commands/agent-os/discover-standards.md index 9dd0c6a0..b5de63ee 100644 --- a/commands/agent-os/discover-standards.md +++ b/commands/agent-os/discover-standards.md @@ -36,7 +36,7 @@ Which area should we focus on for discovering standards? (Pick one, or suggest a Wait for user response before proceeding. -### Step 2: Analyze the Area +### Step 2: Analyze & Present Findings Once an area is determined: @@ -47,7 +47,7 @@ Once an area is determined: - **Tribal** β€” Things a new developer wouldn't know without being told - **Consistent** β€” Patterns repeated across multiple files -3. Use AskUserQuestion to present findings: +3. Use AskUserQuestion to present findings and let user select: ``` I analyzed [area] and found these potential standards worth documenting: @@ -56,7 +56,7 @@ I analyzed [area] and found these potential standards worth documenting: 2. **Error Codes** β€” Custom error codes like AUTH_001, DB_002 with specific meanings 3. **Pagination Pattern** β€” Cursor-based pagination with consistent param names -Would you like to document any of these? You can also suggest other standards for this area. +Which would you like to document? Options: - "Yes, all of them" @@ -65,24 +65,32 @@ Options: - "Skip this area" ``` -### Step 3: Deep Dive on Each Standard +Wait for user selection before proceeding. -For each standard the user wants to document, ask 1-2 targeted questions to understand the reasoning. Use AskUserQuestion for each. +### Step 3: Ask Why, Then Draft Each Standard -Example questions (adapt based on the specific standard): +**IMPORTANT:** For each selected standard, you MUST complete this full loop before moving to the next standard: + +1. **Ask 1-2 clarifying questions** about the "why" behind the pattern. Use your AskUserQuestion tool for this. +2. **Wait for user response** +3. **Draft the standard** incorporating their answer +4. **Confirm with user** before creating the file +5. **Create the file** if approved + +Example questions to ask (adapt based on the specific standard): - "What problem does this pattern solve? Why not use the default/common approach?" - "Are there exceptions where this pattern shouldn't be used?" - "What's the most common mistake a developer or agent makes with this?" -Keep this brief. The goal is capturing the "why" behind the pattern, not exhaustive documentation. +**Do NOT batch all questions upfront.** Process one standard at a time through the full loop. -### Step 4: Write the Standards +### Step 4: Create the Standard File -For each standard: +For each standard (after completing Step 3's Q&A): 1. Determine the appropriate folder (create if needed): - - `api/`, `database/`, `frontend/`, `backend/`, `testing/`, `global/` + - `api/`, `database/`, `javascript/`, `css/`, `backend/`, `testing/`, `global/` 2. Check if a related standard file already exists β€” append to it if so @@ -110,6 +118,7 @@ Create this file? (yes / edit: [your changes] / skip) ``` 4. Create or update the file in `agent-os/standards/[folder]/` +5. **Then repeat Steps 3-4 for the next selected standard** ### Step 5: Update the Index @@ -185,3 +194,68 @@ Use error codes: `AUTH_001`, `DB_001`, `VAL_001` When an error occurs in our application, we have established a consistent pattern for how errors should be formatted and returned to the client. This helps maintain consistency across our API and makes it easier for frontend developers to handle errors appropriately... [continues for 3 more paragraphs] ``` + +## Example: Full Loop for One Standard + +Here's how to process a single standard through the complete workflow: + +**1. Present findings (Step 2):** +``` +I found these patterns in your API code: +1. **Response Envelope** β€” All responses use { success, data, error } +2. **Error Codes** β€” Custom codes like AUTH_001 + +Which would you like to document? +``` + +User: "Both" + +**2. Ask why for first standard (Step 3):** +``` +For the Response Envelope pattern: +- What problem does this solve? Why not return raw data? +- Are there any endpoints that don't use this pattern? +``` + +User: "We use it so the frontend always knows where to find the data. All endpoints use it, no exceptions." + +**3. Draft first standard (Step 3 continued):** +``` +Here's the draft for api/response-envelope.md: + +--- +# Response Envelope + +All API responses use this structure: +\`\`\`json +{ "success": true, "data": { ... } } +{ "success": false, "error": { ... } } +\`\`\` + +- Frontend always checks `success` first, then reads `data` or `error` +- No exceptions β€” every endpoint uses this format +--- + +Create this file? +``` + +User: "Yes" + +**4. Create file, then move to next standard:** + +[Create the file] + +**5. Ask why for second standard (back to Step 3):** +``` +For the Error Codes pattern: +- What's the naming convention for codes? +- Where should new error codes be documented? +``` + +User: "Format is AREA_NUMBER like AUTH_001. We keep a list in the wiki." + +**6. Draft second standard, confirm, create file...** + +[Continue until all selected standards are done] + +**Key point:** Complete the full ask β†’ draft β†’ confirm β†’ create cycle for each standard before starting the next one. From b6f23b6563015d5abfc070c6098230ed944dc025 Mon Sep 17 00:00:00 2001 From: Buddy Burden Date: Mon, 4 May 2026 22:06:22 -0700 Subject: [PATCH 09/12] Fix silent script failure from ((var++)) with set -e (#328) When a bash arithmetic expression ((var++)) is evaluated and var is 0, the post-increment returns the old value (0), which bash treats as a failure exit status. Combined with set -e, this silently kills the script. This caused project-install.sh to exit immediately after printing "Configuration:" without performing any installation. Fix by appending `|| true` to all standalone ((var++)) expressions so the zero-return doesn't trigger set -e. Co-authored-by: Claude Opus 4.6 --- scripts/common-functions.sh | 2 +- scripts/project-install.sh | 16 ++++++++-------- scripts/sync-to-profile.sh | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/scripts/common-functions.sh b/scripts/common-functions.sh index d04a63df..58557307 100755 --- a/scripts/common-functions.sh +++ b/scripts/common-functions.sh @@ -219,7 +219,7 @@ copy_standards() { ensure_dir "$(dirname "$dest_file")" cp "$file" "$dest_file" - ((count++)) + (( count++ )) || true done < <(find "$source_dir" -name "*.md" -type f ! -path "*/.backups/*" -print0 2>/dev/null) echo "$count" diff --git a/scripts/project-install.sh b/scripts/project-install.sh index 8688d4ad..49de18ad 100755 --- a/scripts/project-install.sh +++ b/scripts/project-install.sh @@ -241,11 +241,11 @@ install_standards() { grep -v "^${relative_path}|" "$sources_file" > "${sources_file}.tmp" 2>/dev/null || true mv "${sources_file}.tmp" "$sources_file" echo "${relative_path}|${profile_name}" >> "$sources_file" - ((profile_file_count++)) + (( profile_file_count++ )) || true done < <(find "$profile_standards" -name "*.md" -type f ! -path "*/.backups/*" -print0 2>/dev/null) if [[ "$profile_file_count" -gt 0 ]]; then - ((profiles_used++)) + (( profiles_used++ )) || true fi done <<< "$INHERITANCE_CHAIN" @@ -335,11 +335,11 @@ create_index() { local desc=$(get_existing_description "root" "$filename") if [[ -z "$desc" ]]; then desc="Needs description - run /index-standards" - ((new_count++)) + (( new_count++ )) || true fi echo " $filename:" >> "$temp_file" echo " description: $desc" >> "$temp_file" - ((entry_count++)) + (( entry_count++ )) || true done <<< "$root_files" echo "" >> "$temp_file" fi @@ -357,11 +357,11 @@ create_index() { local desc=$(get_existing_description "$folder_name" "$filename") if [[ -z "$desc" ]]; then desc="Needs description - run /index-standards" - ((new_count++)) + (( new_count++ )) || true fi echo " $filename:" >> "$temp_file" echo " description: $desc" >> "$temp_file" - ((entry_count++)) + (( entry_count++ )) || true done <<< "$md_files" echo "" >> "$temp_file" fi @@ -399,7 +399,7 @@ install_commands() { for file in "$commands_source"/*.md; do if [[ -f "$file" ]]; then cp "$file" "$commands_dest/" - ((count++)) + (( count++ )) || true fi done @@ -447,7 +447,7 @@ main() { done chain_display="$chain_display"$'\n'"$indent ↳ inherits from: $profile_name" fi - ((chain_depth++)) + (( chain_depth++ )) || true done <<< "$reversed_chain" echo "$chain_display" diff --git a/scripts/sync-to-profile.sh b/scripts/sync-to-profile.sh index 0f1a7b07..a63f7d1a 100755 --- a/scripts/sync-to-profile.sh +++ b/scripts/sync-to-profile.sh @@ -194,7 +194,7 @@ select_profile() { for profile in "${profiles[@]}"; do echo " $i) $profile" - ((i++)) + (( i++ )) || true done echo " $i) [Create new profile]" echo "" @@ -273,7 +273,7 @@ select_files() { else echo " $i) [ ] $file" fi - ((i++)) + (( i++ )) || true done echo "" echo "" @@ -449,7 +449,7 @@ backup_files() { if [[ -f "$source_file" ]]; then mkdir -p "$(dirname "$backup_file")" cp "$source_file" "$backup_file" - ((backup_count++)) + (( backup_count++ )) || true print_verbose "Backed up: $file" fi done @@ -477,7 +477,7 @@ execute_sync() { # Copy the file cp "$source_file" "$dest_file" - ((sync_count++)) + (( sync_count++ )) || true print_verbose "Synced: $file" done From 76772a0cc967af56874f5adf507111f6bebe4c0e Mon Sep 17 00:00:00 2001 From: "Brian Casel (via Claude)" Date: Tue, 5 May 2026 01:07:09 -0400 Subject: [PATCH 10/12] Note PR #328 in CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 456d5b6e..ef1b9c8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ Get notified of major releases by subscribing here: https://buildermethods.com/agent-os +## Unreleased + +- Fixed silent install failures caused by `((var++))` under `set -e` in `project-install.sh`, `sync-to-profile.sh`, and `common-functions.sh` (#328). + ## [3.0] - 2026-01-20 Agent OS v3 is a major release that refocuses the framework on what it does bestβ€”establishing and injecting standardsβ€”while deferring to modern AI tools for the parts they now handle better. From dd308c70da69814da05d90caa0a8813eb1b1e131 Mon Sep 17 00:00:00 2001 From: Roduan Kareem Aldeen <37983260+RoduanKD@users.noreply.github.com> Date: Tue, 5 May 2026 08:07:29 +0300 Subject: [PATCH 11/12] Fix "tac command not found" on macOS by using POSIX awk (#327) --- scripts/project-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/project-install.sh b/scripts/project-install.sh index 49de18ad..3f7b34a4 100755 --- a/scripts/project-install.sh +++ b/scripts/project-install.sh @@ -435,7 +435,7 @@ main() { local chain_depth=0 local chain_display="" # Read chain in reverse order (from requested profile back to base) for display - local reversed_chain=$(echo "$INHERITANCE_CHAIN" | tac) + local reversed_chain=$(echo "$INHERITANCE_CHAIN" | awk '{a[NR]=$0} END{for(i=NR;i>=1;i--)print a[i]}') while IFS= read -r profile_name; do [[ -z "$profile_name" ]] && continue if [[ "$chain_depth" -eq 0 ]]; then From cae8e664fb59a01869718c3151e0f45b7a06a2fb Mon Sep 17 00:00:00 2001 From: "Brian Casel (via Claude)" Date: Tue, 5 May 2026 01:07:50 -0400 Subject: [PATCH 12/12] Note PR #327 in CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef1b9c8c..caf3db9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ https://buildermethods.com/agent-os ## Unreleased - Fixed silent install failures caused by `((var++))` under `set -e` in `project-install.sh`, `sync-to-profile.sh`, and `common-functions.sh` (#328). +- Replaced GNU-only `tac` in `project-install.sh` with a POSIX `awk` invocation so installs work on macOS without `coreutils` (#327). ## [3.0] - 2026-01-20