anima-core 0.3.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.reek.yml +27 -1
- data/CHANGELOG.md +4 -0
- data/README.md +219 -25
- data/agents/codebase-analyzer.md +88 -0
- data/agents/codebase-pattern-finder.md +83 -0
- data/agents/documentation-researcher.md +59 -0
- data/agents/thoughts-analyzer.md +102 -0
- data/agents/web-search-researcher.md +71 -0
- data/anima-core.gemspec +3 -0
- data/app/channels/session_channel.rb +76 -28
- data/app/jobs/agent_request_job.rb +24 -0
- data/app/jobs/analytical_brain_job.rb +33 -0
- data/app/jobs/count_event_tokens_job.rb +1 -1
- data/app/models/concerns/event/broadcasting.rb +20 -2
- data/app/models/event.rb +1 -1
- data/app/models/goal.rb +91 -0
- data/app/models/session.rb +347 -22
- data/config/application.rb +2 -0
- data/db/migrate/20260314075248_add_subagent_support_to_sessions.rb +6 -0
- data/db/migrate/20260314112417_add_granted_tools_to_sessions.rb +5 -0
- data/db/migrate/20260314140000_add_name_to_sessions.rb +7 -0
- data/db/migrate/20260314150000_add_viewport_event_ids_to_sessions.rb +7 -0
- data/db/migrate/20260315100000_add_active_skills_to_sessions.rb +7 -0
- data/db/migrate/20260315140843_create_goals.rb +16 -0
- data/db/migrate/20260315144837_add_completed_at_to_goals.rb +5 -0
- data/db/migrate/20260315191105_add_active_workflow_to_sessions.rb +5 -0
- data/lib/agent_loop.rb +65 -9
- data/lib/agents/definition.rb +116 -0
- data/lib/agents/registry.rb +106 -0
- data/lib/analytical_brain/runner.rb +276 -0
- data/lib/analytical_brain/tools/activate_skill.rb +52 -0
- data/lib/analytical_brain/tools/deactivate_skill.rb +43 -0
- data/lib/analytical_brain/tools/deactivate_workflow.rb +34 -0
- data/lib/analytical_brain/tools/everything_is_ready.rb +28 -0
- data/lib/analytical_brain/tools/finish_goal.rb +62 -0
- data/lib/analytical_brain/tools/read_workflow.rb +58 -0
- data/lib/analytical_brain/tools/rename_session.rb +63 -0
- data/lib/analytical_brain/tools/set_goal.rb +60 -0
- data/lib/analytical_brain/tools/update_goal.rb +60 -0
- data/lib/analytical_brain.rb +23 -0
- data/lib/anima/cli/mcp/secrets.rb +76 -0
- data/lib/anima/cli/mcp.rb +197 -0
- data/lib/anima/cli.rb +4 -0
- data/lib/anima/installer.rb +168 -0
- data/lib/anima/settings.rb +226 -0
- data/lib/anima/version.rb +1 -1
- data/lib/anima.rb +9 -0
- data/lib/credential_store.rb +103 -0
- data/lib/environment_probe.rb +232 -0
- data/lib/llm/client.rb +29 -10
- data/lib/mcp/client_manager.rb +86 -0
- data/lib/mcp/config.rb +213 -0
- data/lib/mcp/health_check.rb +77 -0
- data/lib/mcp/secrets.rb +73 -0
- data/lib/mcp/stdio_transport.rb +206 -0
- data/lib/providers/anthropic.rb +8 -7
- data/lib/shell_session.rb +11 -10
- data/lib/skills/definition.rb +97 -0
- data/lib/skills/registry.rb +105 -0
- data/lib/tools/edit.rb +3 -4
- data/lib/tools/mcp_tool.rb +114 -0
- data/lib/tools/read.rb +15 -16
- data/lib/tools/registry.rb +14 -12
- data/lib/tools/request_feature.rb +121 -0
- data/lib/tools/return_result.rb +81 -0
- data/lib/tools/spawn_specialist.rb +109 -0
- data/lib/tools/spawn_subagent.rb +111 -0
- data/lib/tools/subagent_prompts.rb +12 -0
- data/lib/tools/web_get.rb +8 -9
- data/lib/tui/app.rb +332 -43
- data/lib/tui/message_store.rb +20 -0
- data/lib/tui/screens/chat.rb +207 -20
- data/lib/workflows/definition.rb +97 -0
- data/lib/workflows/registry.rb +89 -0
- data/skills/activerecord/SKILL.md +255 -0
- data/skills/activerecord/examples/associations/association_extensions.rb +298 -0
- data/skills/activerecord/examples/associations/basic_associations.rb +118 -0
- data/skills/activerecord/examples/associations/counter_caches.rb +215 -0
- data/skills/activerecord/examples/associations/polymorphic_associations.rb +217 -0
- data/skills/activerecord/examples/associations/self_referential.rb +302 -0
- data/skills/activerecord/examples/associations/through_associations.rb +203 -0
- data/skills/activerecord/examples/basics/crud_operations.rb +209 -0
- data/skills/activerecord/examples/basics/dirty_tracking.rb +218 -0
- data/skills/activerecord/examples/basics/inheritance.rb +377 -0
- data/skills/activerecord/examples/basics/type_casting.rb +317 -0
- data/skills/activerecord/examples/callbacks/alternatives_to_callbacks.rb +447 -0
- data/skills/activerecord/examples/callbacks/conditional_callbacks.rb +353 -0
- data/skills/activerecord/examples/callbacks/lifecycle_callbacks.rb +280 -0
- data/skills/activerecord/examples/callbacks/transaction_callbacks.rb +340 -0
- data/skills/activerecord/examples/migrations/indexes_and_constraints.rb +337 -0
- data/skills/activerecord/examples/migrations/reversible_patterns.rb +403 -0
- data/skills/activerecord/examples/migrations/safe_patterns.rb +420 -0
- data/skills/activerecord/examples/migrations/schema_changes.rb +277 -0
- data/skills/activerecord/examples/querying/batch_processing.rb +226 -0
- data/skills/activerecord/examples/querying/eager_loading.rb +259 -0
- data/skills/activerecord/examples/querying/finder_methods.rb +170 -0
- data/skills/activerecord/examples/querying/optimization.rb +275 -0
- data/skills/activerecord/examples/querying/scopes.rb +260 -0
- data/skills/activerecord/examples/validations/built_in_validators.rb +277 -0
- data/skills/activerecord/examples/validations/conditional_validations.rb +288 -0
- data/skills/activerecord/examples/validations/custom_validators.rb +381 -0
- data/skills/activerecord/examples/validations/database_constraints.rb +432 -0
- data/skills/activerecord/examples/validations/validation_contexts.rb +367 -0
- data/skills/activerecord/references/associations.md +709 -0
- data/skills/activerecord/references/basics.md +622 -0
- data/skills/activerecord/references/callbacks.md +738 -0
- data/skills/activerecord/references/migrations.md +657 -0
- data/skills/activerecord/references/querying.md +655 -0
- data/skills/activerecord/references/validations.md +596 -0
- data/skills/dragonruby/SKILL.md +250 -0
- data/skills/dragonruby/examples/audio/audio_events.rb +55 -0
- data/skills/dragonruby/examples/audio/background_music.rb +29 -0
- data/skills/dragonruby/examples/audio/crossfade.rb +51 -0
- data/skills/dragonruby/examples/audio/music_controls.rb +51 -0
- data/skills/dragonruby/examples/audio/sound_effects.rb +30 -0
- data/skills/dragonruby/examples/core/coordinate_system.rb +27 -0
- data/skills/dragonruby/examples/core/hello_world.rb +24 -0
- data/skills/dragonruby/examples/core/labels.rb +22 -0
- data/skills/dragonruby/examples/core/sprites.rb +35 -0
- data/skills/dragonruby/examples/core/state_management.rb +29 -0
- data/skills/dragonruby/examples/distribution/background_pause.rb +42 -0
- data/skills/dragonruby/examples/distribution/build_workflow.sh +26 -0
- data/skills/dragonruby/examples/distribution/cvars_production.txt +16 -0
- data/skills/dragonruby/examples/distribution/game_metadata_hd.txt +23 -0
- data/skills/dragonruby/examples/distribution/game_metadata_minimal.txt +9 -0
- data/skills/dragonruby/examples/distribution/game_metadata_mobile.txt +31 -0
- data/skills/dragonruby/examples/distribution/platform_detection.rb +36 -0
- data/skills/dragonruby/examples/distribution/steam_metadata.txt +19 -0
- data/skills/dragonruby/examples/entities/collision_detection.rb +43 -0
- data/skills/dragonruby/examples/entities/entity_lifecycle.rb +68 -0
- data/skills/dragonruby/examples/entities/entity_storage.rb +38 -0
- data/skills/dragonruby/examples/entities/factory_methods.rb +45 -0
- data/skills/dragonruby/examples/entities/random_spawning.rb +50 -0
- data/skills/dragonruby/examples/game-logic/reset_patterns.rb +98 -0
- data/skills/dragonruby/examples/game-logic/save_load.rb +101 -0
- data/skills/dragonruby/examples/game-logic/scoring.rb +104 -0
- data/skills/dragonruby/examples/game-logic/state_transitions.rb +103 -0
- data/skills/dragonruby/examples/game-logic/timers.rb +87 -0
- data/skills/dragonruby/examples/input/action_triggers.rb +36 -0
- data/skills/dragonruby/examples/input/analog_movement.rb +28 -0
- data/skills/dragonruby/examples/input/controller_input.rb +28 -0
- data/skills/dragonruby/examples/input/directional_input.rb +24 -0
- data/skills/dragonruby/examples/input/keyboard_input.rb +28 -0
- data/skills/dragonruby/examples/input/mouse_click.rb +26 -0
- data/skills/dragonruby/examples/input/movement_with_bounds.rb +22 -0
- data/skills/dragonruby/examples/input/normalized_movement.rb +32 -0
- data/skills/dragonruby/examples/rendering/frame_animation.rb +32 -0
- data/skills/dragonruby/examples/rendering/labels.rb +32 -0
- data/skills/dragonruby/examples/rendering/layering.rb +51 -0
- data/skills/dragonruby/examples/rendering/solids.rb +61 -0
- data/skills/dragonruby/examples/rendering/sprites.rb +33 -0
- data/skills/dragonruby/examples/rendering/spritesheet_animation.rb +39 -0
- data/skills/dragonruby/examples/scenes/case_dispatch.rb +60 -0
- data/skills/dragonruby/examples/scenes/class_based.rb +150 -0
- data/skills/dragonruby/examples/scenes/pause_overlay.rb +100 -0
- data/skills/dragonruby/examples/scenes/safe_transitions.rb +68 -0
- data/skills/dragonruby/examples/scenes/scene_transitions.rb +98 -0
- data/skills/dragonruby/examples/scenes/send_dispatch.rb +88 -0
- data/skills/dragonruby/references/audio.md +396 -0
- data/skills/dragonruby/references/core.md +385 -0
- data/skills/dragonruby/references/distribution.md +434 -0
- data/skills/dragonruby/references/entities.md +516 -0
- data/skills/dragonruby/references/game-logic/persistence.md +386 -0
- data/skills/dragonruby/references/game-logic/state.md +389 -0
- data/skills/dragonruby/references/input.md +414 -0
- data/skills/dragonruby/references/rendering/animation.md +467 -0
- data/skills/dragonruby/references/rendering/primitives.md +403 -0
- data/skills/dragonruby/references/scenes.md +443 -0
- data/skills/draper-decorators/SKILL.md +344 -0
- data/skills/draper-decorators/examples/application_decorator.rb +61 -0
- data/skills/draper-decorators/examples/decorator_spec.rb +253 -0
- data/skills/draper-decorators/examples/model_decorator.rb +152 -0
- data/skills/draper-decorators/references/anti-patterns.md +640 -0
- data/skills/draper-decorators/references/patterns.md +507 -0
- data/skills/draper-decorators/references/testing.md +559 -0
- data/skills/gh-issue.md +182 -0
- data/skills/mcp-server/SKILL.md +177 -0
- data/skills/mcp-server/examples/dynamic_tools.rb +36 -0
- data/skills/mcp-server/examples/file_manager_tool.rb +85 -0
- data/skills/mcp-server/examples/http_client.rb +48 -0
- data/skills/mcp-server/examples/http_server.rb +97 -0
- data/skills/mcp-server/examples/rails_integration.rb +88 -0
- data/skills/mcp-server/examples/stdio_server.rb +108 -0
- data/skills/mcp-server/examples/streaming_client.rb +95 -0
- data/skills/mcp-server/references/gotchas.md +183 -0
- data/skills/mcp-server/references/prompts.md +98 -0
- data/skills/mcp-server/references/resources.md +53 -0
- data/skills/mcp-server/references/server.md +140 -0
- data/skills/mcp-server/references/tools.md +146 -0
- data/skills/mcp-server/references/transport.md +104 -0
- data/skills/ratatui-ruby/SKILL.md +315 -0
- data/skills/ratatui-ruby/references/core-concepts.md +340 -0
- data/skills/ratatui-ruby/references/events.md +387 -0
- data/skills/ratatui-ruby/references/frameworks.md +522 -0
- data/skills/ratatui-ruby/references/layout.md +423 -0
- data/skills/ratatui-ruby/references/styling.md +268 -0
- data/skills/ratatui-ruby/references/testing.md +433 -0
- data/skills/ratatui-ruby/references/widgets.md +532 -0
- data/skills/rspec/SKILL.md +340 -0
- data/skills/rspec/examples/core/basic_structure.rb +69 -0
- data/skills/rspec/examples/core/configuration.rb +126 -0
- data/skills/rspec/examples/core/hooks.rb +126 -0
- data/skills/rspec/examples/core/memoized_helpers.rb +139 -0
- data/skills/rspec/examples/core/metadata_filtering.rb +144 -0
- data/skills/rspec/examples/core/shared_examples.rb +145 -0
- data/skills/rspec/examples/factory_bot/associations.rb +314 -0
- data/skills/rspec/examples/factory_bot/build_strategies.rb +272 -0
- data/skills/rspec/examples/factory_bot/callbacks.rb +320 -0
- data/skills/rspec/examples/factory_bot/custom_construction.rb +328 -0
- data/skills/rspec/examples/factory_bot/factory_definition.rb +191 -0
- data/skills/rspec/examples/factory_bot/inheritance.rb +314 -0
- data/skills/rspec/examples/factory_bot/traits.rb +293 -0
- data/skills/rspec/examples/factory_bot/transients.rb +229 -0
- data/skills/rspec/examples/matchers/change.rb +115 -0
- data/skills/rspec/examples/matchers/collections.rb +154 -0
- data/skills/rspec/examples/matchers/comparisons.rb +79 -0
- data/skills/rspec/examples/matchers/composing.rb +155 -0
- data/skills/rspec/examples/matchers/custom_matchers.rb +197 -0
- data/skills/rspec/examples/matchers/equality.rb +58 -0
- data/skills/rspec/examples/matchers/errors.rb +136 -0
- data/skills/rspec/examples/matchers/output.rb +103 -0
- data/skills/rspec/examples/matchers/predicates.rb +87 -0
- data/skills/rspec/examples/matchers/truthiness.rb +101 -0
- data/skills/rspec/examples/matchers/types.rb +82 -0
- data/skills/rspec/examples/matchers/yield.rb +147 -0
- data/skills/rspec/examples/mocks/any_instance.rb +172 -0
- data/skills/rspec/examples/mocks/argument_matchers.rb +206 -0
- data/skills/rspec/examples/mocks/constants.rb +177 -0
- data/skills/rspec/examples/mocks/doubles.rb +139 -0
- data/skills/rspec/examples/mocks/expectations.rb +137 -0
- data/skills/rspec/examples/mocks/message_chains.rb +173 -0
- data/skills/rspec/examples/mocks/ordering.rb +144 -0
- data/skills/rspec/examples/mocks/receive_counts.rb +181 -0
- data/skills/rspec/examples/mocks/responses.rb +223 -0
- data/skills/rspec/examples/mocks/spies.rb +149 -0
- data/skills/rspec/examples/mocks/stubbing.rb +133 -0
- data/skills/rspec/examples/rails/channels.rb +250 -0
- data/skills/rspec/examples/rails/controller_specs.rb +302 -0
- data/skills/rspec/examples/rails/helper_specs.rb +245 -0
- data/skills/rspec/examples/rails/job_specs.rb +256 -0
- data/skills/rspec/examples/rails/mailer_specs.rb +228 -0
- data/skills/rspec/examples/rails/matchers.rb +374 -0
- data/skills/rspec/examples/rails/model_specs.rb +193 -0
- data/skills/rspec/examples/rails/request_specs.rb +275 -0
- data/skills/rspec/examples/rails/routing_specs.rb +276 -0
- data/skills/rspec/examples/rails/system_specs.rb +294 -0
- data/skills/rspec/examples/rails/transactions.rb +254 -0
- data/skills/rspec/examples/rails/view_specs.rb +252 -0
- data/skills/rspec/references/core.md +816 -0
- data/skills/rspec/references/factory_bot.md +641 -0
- data/skills/rspec/references/matchers.md +516 -0
- data/skills/rspec/references/mocks.md +381 -0
- data/skills/rspec/references/rails.md +528 -0
- data/templates/soul.md +40 -0
- data/workflows/commit.md +45 -0
- data/workflows/create_handoff.md +98 -0
- data/workflows/create_note.md +82 -0
- data/workflows/create_plan.md +457 -0
- data/workflows/decompose_ticket.md +109 -0
- data/workflows/feature.md +91 -0
- data/workflows/implement_plan.md +87 -0
- data/workflows/iterate_plan.md +247 -0
- data/workflows/research_codebase.md +210 -0
- data/workflows/resume_handoff.md +217 -0
- data/workflows/review_pr.md +320 -0
- data/workflows/thoughts_init.md +71 -0
- data/workflows/validate_plan.md +166 -0
- metadata +284 -1
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: resume_handoff
|
|
3
|
+
description: "Resume work from a handoff document with context analysis and validation."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Resume work from a handoff document
|
|
7
|
+
|
|
8
|
+
You are tasked with resuming work from a handoff document through an interactive process. These handoffs contain critical context, learnings, and next steps from previous work sessions that need to be understood and continued.
|
|
9
|
+
|
|
10
|
+
## Initial Response
|
|
11
|
+
|
|
12
|
+
When this command is invoked:
|
|
13
|
+
|
|
14
|
+
1. **If the path to a handoff document was provided**:
|
|
15
|
+
- If a handoff document path was provided as a parameter, skip the default message
|
|
16
|
+
- Immediately read the handoff document FULLY
|
|
17
|
+
- Immediately read any research or plan documents that it links to under `./thoughts/shared/plans` or `./thoughts/shared/research`. do NOT use a sub-agent to read these critical files.
|
|
18
|
+
- Begin the analysis process by ingesting relevant context from the handoff document, reading additional files it mentions
|
|
19
|
+
- Then propose a course of action to the user and confirm, or ask for clarification on direction.
|
|
20
|
+
|
|
21
|
+
2. **If a GitHub issue number was provided**:
|
|
22
|
+
- run `thoughts-sync` to ensure your `./thoughts/` directory is up to date.
|
|
23
|
+
- locate the most recent handoff document for the issue. Handoffs are located in `./thoughts/shared/handoffs/<issue-number>/`. e.g. for issue #170 the handoffs would be in `./thoughts/shared/handoffs/170/`. **List this directory's contents recursively** (handoffs are in date subdirectories like `YYYY-MM-DD/`).
|
|
24
|
+
- There may be zero, one or multiple files across the date subdirectories.
|
|
25
|
+
- **If there are zero files, or the directory does not exist**: tell the user: "I'm sorry, I can't seem to find that handoff document. Can you please provide me with a path to it?"
|
|
26
|
+
- **If there is only one file**: proceed with that handoff
|
|
27
|
+
- **If there are multiple files**: using the date from the subdirectory name (`YYYY-MM-DD`) and time from the filename (`HH-MM-SS`), proceed with the _most recent_ handoff document.
|
|
28
|
+
- Immediately read the handoff document FULLY
|
|
29
|
+
- Immediately read any research or plan documents that it links to under `./thoughts/shared/plans` or `./thoughts/shared/research`; do NOT use a sub-agent to read these critical files.
|
|
30
|
+
- Begin the analysis process by ingesting relevant context from the handoff document, reading additional files it mentions
|
|
31
|
+
- Then propose a course of action to the user and confirm, or ask for clarification on direction.
|
|
32
|
+
|
|
33
|
+
3. **If no parameters provided**, respond with:
|
|
34
|
+
```
|
|
35
|
+
I'll help you resume work from a handoff document. Let me find the available handoffs.
|
|
36
|
+
|
|
37
|
+
Which handoff would you like to resume from?
|
|
38
|
+
|
|
39
|
+
Provide a handoff path (e.g., `./thoughts/shared/handoffs/170/2026-03-15/13-44-55_170_description.md`)
|
|
40
|
+
or a GitHub issue number to resume from the most recent handoff for that issue.
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then wait for the user's input.
|
|
44
|
+
|
|
45
|
+
## Process Steps
|
|
46
|
+
|
|
47
|
+
### Step 1: Read and Analyze Handoff
|
|
48
|
+
|
|
49
|
+
1. **Read handoff document completely**:
|
|
50
|
+
- Use the Read tool WITHOUT limit/offset parameters
|
|
51
|
+
- Extract all sections:
|
|
52
|
+
- Task(s) and their statuses
|
|
53
|
+
- Recent changes
|
|
54
|
+
- Learnings
|
|
55
|
+
- Artifacts
|
|
56
|
+
- Action items and next steps
|
|
57
|
+
- Other notes
|
|
58
|
+
|
|
59
|
+
2. **Spawn focused research tasks**:
|
|
60
|
+
Based on the handoff content, spawn parallel research tasks to verify current state:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
Task 1 - Gather artifact context:
|
|
64
|
+
Read all artifacts mentioned in the handoff.
|
|
65
|
+
1. Read feature documents listed in "Artifacts"
|
|
66
|
+
2. Read implementation plans referenced
|
|
67
|
+
3. Read any research documents mentioned
|
|
68
|
+
4. Extract key requirements and decisions
|
|
69
|
+
Use tools: Read
|
|
70
|
+
Return: Summary of artifact contents and key decisions
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
3. **Wait for ALL sub-tasks to complete** before proceeding
|
|
74
|
+
|
|
75
|
+
4. **Read critical files identified**:
|
|
76
|
+
- Read files from "Learnings" section completely
|
|
77
|
+
- Read files from "Recent changes" to understand modifications
|
|
78
|
+
- Read any new related files discovered during research
|
|
79
|
+
|
|
80
|
+
### Step 2: Synthesize and Present Analysis
|
|
81
|
+
|
|
82
|
+
1. **Present comprehensive analysis**:
|
|
83
|
+
```
|
|
84
|
+
I've analyzed the handoff from [date] by [researcher]. Here's the current situation:
|
|
85
|
+
|
|
86
|
+
**Original Tasks:**
|
|
87
|
+
- [Task 1]: [Status from handoff] → [Current verification]
|
|
88
|
+
- [Task 2]: [Status from handoff] → [Current verification]
|
|
89
|
+
|
|
90
|
+
**Key Learnings Validated:**
|
|
91
|
+
- [Learning with file:line reference] - [Still valid/Changed]
|
|
92
|
+
- [Pattern discovered] - [Still applicable/Modified]
|
|
93
|
+
|
|
94
|
+
**Recent Changes Status:**
|
|
95
|
+
- [Change 1] - [Verified present/Missing/Modified]
|
|
96
|
+
- [Change 2] - [Verified present/Missing/Modified]
|
|
97
|
+
|
|
98
|
+
**Artifacts Reviewed:**
|
|
99
|
+
- [Document 1]: [Key takeaway]
|
|
100
|
+
- [Document 2]: [Key takeaway]
|
|
101
|
+
|
|
102
|
+
**Recommended Next Actions:**
|
|
103
|
+
Based on the handoff's action items and current state:
|
|
104
|
+
1. [Most logical next step based on handoff]
|
|
105
|
+
2. [Second priority action]
|
|
106
|
+
3. [Additional tasks discovered]
|
|
107
|
+
|
|
108
|
+
**Potential Issues Identified:**
|
|
109
|
+
- [Any conflicts or regressions found]
|
|
110
|
+
- [Missing dependencies or broken code]
|
|
111
|
+
|
|
112
|
+
Shall I proceed with [recommended action 1], or would you like to adjust the approach?
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
2. **Get confirmation** before proceeding
|
|
116
|
+
|
|
117
|
+
### Step 3: Create Action Plan
|
|
118
|
+
|
|
119
|
+
1. **Create task list**:
|
|
120
|
+
- Convert action items from handoff into todos
|
|
121
|
+
- Add any new tasks discovered during analysis
|
|
122
|
+
- Prioritize based on dependencies and handoff guidance
|
|
123
|
+
|
|
124
|
+
2. **Present the plan**:
|
|
125
|
+
```
|
|
126
|
+
I've created a task list based on the handoff and current analysis:
|
|
127
|
+
|
|
128
|
+
[Show todo list]
|
|
129
|
+
|
|
130
|
+
Ready to begin with the first task: [task description]?
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Step 4: Begin Implementation
|
|
134
|
+
|
|
135
|
+
1. **Start with the first approved task**
|
|
136
|
+
2. **Reference learnings from handoff** throughout implementation
|
|
137
|
+
3. **Apply patterns and approaches documented** in the handoff
|
|
138
|
+
4. **Update progress** as tasks are completed
|
|
139
|
+
|
|
140
|
+
## Guidelines
|
|
141
|
+
|
|
142
|
+
1. **Be Thorough in Analysis**:
|
|
143
|
+
- Read the entire handoff document first
|
|
144
|
+
- Verify ALL mentioned changes still exist
|
|
145
|
+
- Check for any regressions or conflicts
|
|
146
|
+
- Read all referenced artifacts
|
|
147
|
+
|
|
148
|
+
2. **Be Interactive**:
|
|
149
|
+
- Present findings before starting work
|
|
150
|
+
- Get buy-in on the approach
|
|
151
|
+
- Allow for course corrections
|
|
152
|
+
- Adapt based on current state vs handoff state
|
|
153
|
+
|
|
154
|
+
3. **Leverage Handoff Wisdom**:
|
|
155
|
+
- Pay special attention to "Learnings" section
|
|
156
|
+
- Apply documented patterns and approaches
|
|
157
|
+
- Avoid repeating mistakes mentioned
|
|
158
|
+
- Build on discovered solutions
|
|
159
|
+
|
|
160
|
+
4. **Track Continuity**:
|
|
161
|
+
- Maintain task continuity
|
|
162
|
+
- Reference the handoff document in commits
|
|
163
|
+
- Document any deviations from original plan
|
|
164
|
+
- Consider creating a new handoff when done
|
|
165
|
+
|
|
166
|
+
5. **Validate Before Acting**:
|
|
167
|
+
- Never assume handoff state matches current state
|
|
168
|
+
- Verify all file references still exist
|
|
169
|
+
- Check for breaking changes since handoff
|
|
170
|
+
- Confirm patterns are still valid
|
|
171
|
+
|
|
172
|
+
## Common Scenarios
|
|
173
|
+
|
|
174
|
+
### Scenario 1: Clean Continuation
|
|
175
|
+
- All changes from handoff are present
|
|
176
|
+
- No conflicts or regressions
|
|
177
|
+
- Clear next steps in action items
|
|
178
|
+
- Proceed with recommended actions
|
|
179
|
+
|
|
180
|
+
### Scenario 2: Diverged Codebase
|
|
181
|
+
- Some changes missing or modified
|
|
182
|
+
- New related code added since handoff
|
|
183
|
+
- Need to reconcile differences
|
|
184
|
+
- Adapt plan based on current state
|
|
185
|
+
|
|
186
|
+
### Scenario 3: Incomplete Handoff Work
|
|
187
|
+
- Tasks marked as "in_progress" in handoff
|
|
188
|
+
- Need to complete unfinished work first
|
|
189
|
+
- May need to re-understand partial implementations
|
|
190
|
+
- Focus on completing before new work
|
|
191
|
+
|
|
192
|
+
### Scenario 4: Stale Handoff
|
|
193
|
+
- Significant time has passed
|
|
194
|
+
- Major refactoring has occurred
|
|
195
|
+
- Original approach may no longer apply
|
|
196
|
+
- Need to re-evaluate strategy
|
|
197
|
+
|
|
198
|
+
## Example Interaction Flow
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
User: resume_handoff specification/feature/handoffs/handoff-0.md
|
|
202
|
+
Assistant: Let me read and analyze that handoff document...
|
|
203
|
+
|
|
204
|
+
[Reads handoff completely]
|
|
205
|
+
[Spawns research tasks]
|
|
206
|
+
[Waits for completion]
|
|
207
|
+
[Reads identified files]
|
|
208
|
+
|
|
209
|
+
I've analyzed the handoff from [date]. Here's the current situation...
|
|
210
|
+
|
|
211
|
+
[Presents analysis]
|
|
212
|
+
|
|
213
|
+
Shall I proceed with implementing the webhook validation fix, or would you like to adjust the approach?
|
|
214
|
+
|
|
215
|
+
User: Yes, proceed with the webhook validation
|
|
216
|
+
Assistant: [Creates todo list and begins implementation]
|
|
217
|
+
```
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review_pr
|
|
3
|
+
description: "Multi-agent PR review with three modes: review, re-review, self-review."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Modes
|
|
7
|
+
|
|
8
|
+
- **review** (default): Full review, present findings for approval before posting
|
|
9
|
+
- **re-review**: Also load existing review feedback; verify previously requested changes were addressed
|
|
10
|
+
- **self-review**: Fix findings directly in code instead of posting a review
|
|
11
|
+
|
|
12
|
+
## Process
|
|
13
|
+
|
|
14
|
+
### Step 1: Gather PR Metadata
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
gh pr view <PR_NUMBER> --json number,title,body,url,headRefName,baseRefName
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Extract from PR body:
|
|
21
|
+
- **Issue reference** (e.g., #123) — if found, fetch full issue details for requirements and acceptance criteria via `gh issue view`
|
|
22
|
+
- **Business context** — why this change is needed
|
|
23
|
+
|
|
24
|
+
If re-review mode is activated, also save all existing review feedback to `/tmp/` without reading them:
|
|
25
|
+
```bash
|
|
26
|
+
# Review verdicts and bodies (APPROVED, CHANGES_REQUESTED, COMMENTED)
|
|
27
|
+
gh api repos/<OWNER>/<REPO>/pulls/<PR_NUMBER>/reviews | tee /tmp/pr_<NUMBER>_reviews.json | jq length
|
|
28
|
+
|
|
29
|
+
# Inline review comments on specific diff lines
|
|
30
|
+
gh api repos/<OWNER>/<REPO>/pulls/<PR_NUMBER>/comments | tee /tmp/pr_<NUMBER>_inline_comments.json | jq length
|
|
31
|
+
|
|
32
|
+
# Conversation-level comments
|
|
33
|
+
gh api repos/<OWNER>/<REPO>/issues/<PR_NUMBER>/comments | tee /tmp/pr_<NUMBER>_conversation.json | jq length
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Step 2: Fetch and Save Diff
|
|
37
|
+
|
|
38
|
+
Checkout the PR branch locally and generate the diff. Save it to `/tmp/` — only subagents will read it.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git fetch origin
|
|
42
|
+
git checkout <branch>
|
|
43
|
+
|
|
44
|
+
# Use merge-base for a clean diff (handles diverged base branch)
|
|
45
|
+
BASE=$(git merge-base origin/<baseRefName> HEAD)
|
|
46
|
+
git diff $BASE -- . > /tmp/pr_<NUMBER>_diff.txt
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
If the user provided file exclusion or inclusion patterns in additional instructions, apply them using git's pathspec syntax:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Exclude specific paths
|
|
53
|
+
git diff $BASE -- . ':(exclude)path/to/noisy/dir' ':(exclude)*.ext' > /tmp/pr_<NUMBER>_diff.txt
|
|
54
|
+
|
|
55
|
+
# Include only specific directories
|
|
56
|
+
git diff $BASE -- path/to/dir1/ path/to/dir2/ > /tmp/pr_<NUMBER>_diff.txt
|
|
57
|
+
|
|
58
|
+
# Combine inclusion with exclusion
|
|
59
|
+
git diff $BASE -- path/to/dir/ ':(exclude)path/to/dir/subdir' > /tmp/pr_<NUMBER>_diff.txt
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Verify the diff is non-empty: `wc -l < /tmp/pr_<NUMBER>_diff.txt`
|
|
63
|
+
|
|
64
|
+
### Step 3: Gather Historical Context
|
|
65
|
+
|
|
66
|
+
Spawn the **thoughts-analyzer** specialist to find historical knowledge about affected features.
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
specialist: thoughts-analyzer
|
|
70
|
+
|
|
71
|
+
Prompt: "What do we know about <ticket reference and title from Step 1>? What decisions, constraints, and trade-offs should reviewers be aware of?"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Wait for this specialist to complete before proceeding.**
|
|
75
|
+
|
|
76
|
+
### Step 4: Spawn Review Subagents
|
|
77
|
+
|
|
78
|
+
Spawn all five review subagents **in parallel** using `spawn_subagent`. Each receives:
|
|
79
|
+
- Path to the diff file in `/tmp/`
|
|
80
|
+
- Ticket context (from Step 1)
|
|
81
|
+
- Historical context (from Step 3)
|
|
82
|
+
- Their specific review focus
|
|
83
|
+
- Any additional instructions from the user's input
|
|
84
|
+
|
|
85
|
+
If re-review mode is activated, each subagent also receives the paths to `/tmp/pr_<NUMBER>_reviews.json`, `/tmp/pr_<NUMBER>_inline_comments.json`, and `/tmp/pr_<NUMBER>_conversation.json` with this modified instruction: "Primary goal: verify that previously requested changes were addressed. Secondary goal: check for new problems introduced."
|
|
86
|
+
|
|
87
|
+
**Critical:** Spawn all five subagents in parallel to ensure concurrent execution.
|
|
88
|
+
|
|
89
|
+
#### Subagent 1: RailsGuru
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
Prompt: "Review PR #<number> for Rails conventions and architecture.
|
|
93
|
+
|
|
94
|
+
Read the diff from: /tmp/pr_<number>_diff.txt
|
|
95
|
+
|
|
96
|
+
*Critical:* Activate the `activerecord` skill for AR patterns reference.
|
|
97
|
+
|
|
98
|
+
## Ticket Context
|
|
99
|
+
<ticket title, acceptance criteria, business context>
|
|
100
|
+
|
|
101
|
+
## Historical Context
|
|
102
|
+
<output from thoughts-analyzer>
|
|
103
|
+
|
|
104
|
+
<any additional instructions from user input>
|
|
105
|
+
|
|
106
|
+
## Focus Areas
|
|
107
|
+
- MVC boundary violations (fat controllers, logic in views)
|
|
108
|
+
- Rails idioms (proper use of scopes, callbacks, concerns)
|
|
109
|
+
- REST conventions and route design
|
|
110
|
+
- ActiveRecord patterns (associations, validations placement)
|
|
111
|
+
- Service object patterns and naming
|
|
112
|
+
|
|
113
|
+
Output: List findings tagged [major], [minor], or [nit] with file:line references."
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
#### Subagent 2: SecurityHawk
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
Prompt: "Review PR #<number> for security vulnerabilities.
|
|
120
|
+
|
|
121
|
+
Read the diff from: /tmp/pr_<number>_diff.txt
|
|
122
|
+
|
|
123
|
+
*Critical:* Activate the `activerecord` skill for SQL injection prevention patterns.
|
|
124
|
+
|
|
125
|
+
## Ticket Context
|
|
126
|
+
<ticket title, acceptance criteria, business context>
|
|
127
|
+
|
|
128
|
+
## Historical Context
|
|
129
|
+
<output from thoughts-analyzer>
|
|
130
|
+
|
|
131
|
+
<any additional instructions from user input>
|
|
132
|
+
|
|
133
|
+
## Focus Areas
|
|
134
|
+
- SQL injection (raw queries, interpolation in where clauses)
|
|
135
|
+
- XSS vulnerabilities (unescaped output, html_safe misuse)
|
|
136
|
+
- CSRF protection gaps
|
|
137
|
+
- Mass assignment vulnerabilities (permit params)
|
|
138
|
+
- Authentication/authorization bypasses
|
|
139
|
+
- Secrets or credentials in code
|
|
140
|
+
- Insecure direct object references
|
|
141
|
+
|
|
142
|
+
Output: List findings tagged [major], [minor], or [nit] with file:line references."
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
#### Subagent 3: PerfPro
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
Prompt: "Review PR #<number> for performance issues.
|
|
149
|
+
|
|
150
|
+
Read the diff from: /tmp/pr_<number>_diff.txt
|
|
151
|
+
|
|
152
|
+
*Critical:* Activate the `activerecord` skill for N+1 and query optimization patterns.
|
|
153
|
+
|
|
154
|
+
## Ticket Context
|
|
155
|
+
<ticket title, acceptance criteria, business context>
|
|
156
|
+
|
|
157
|
+
## Historical Context
|
|
158
|
+
<output from thoughts-analyzer>
|
|
159
|
+
|
|
160
|
+
<any additional instructions from user input>
|
|
161
|
+
|
|
162
|
+
## Focus Areas
|
|
163
|
+
- N+1 query patterns (missing includes/preload/eager_load)
|
|
164
|
+
- Expensive queries in loops
|
|
165
|
+
- Missing database indexes for new queries
|
|
166
|
+
- Inefficient ActiveRecord usage (pluck vs select, find_each vs each)
|
|
167
|
+
- Memory bloat (loading large datasets)
|
|
168
|
+
- Missing caching opportunities
|
|
169
|
+
- Background job considerations (should this be async?)
|
|
170
|
+
|
|
171
|
+
Output: List findings tagged [major], [minor], or [nit] with file:line references."
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
#### Subagent 4: TestCoach
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
Prompt: "Review PR #<number> for test quality and coverage.
|
|
178
|
+
|
|
179
|
+
Read the diff from: /tmp/pr_<number>_diff.txt
|
|
180
|
+
|
|
181
|
+
*Critical:* Activate the `rspec` skill for RSpec best practices reference.
|
|
182
|
+
|
|
183
|
+
## Ticket Context
|
|
184
|
+
<ticket title, acceptance criteria, business context>
|
|
185
|
+
|
|
186
|
+
## Historical Context
|
|
187
|
+
<output from thoughts-analyzer>
|
|
188
|
+
|
|
189
|
+
<any additional instructions from user input>
|
|
190
|
+
|
|
191
|
+
## Focus Areas
|
|
192
|
+
- Missing test coverage for new code paths
|
|
193
|
+
- Flaky test patterns (time-dependent, order-dependent)
|
|
194
|
+
- Factory usage (proper traits, avoiding create when build suffices)
|
|
195
|
+
- Test isolation issues (shared state, missing cleanup)
|
|
196
|
+
- Assertion quality (testing behavior vs implementation)
|
|
197
|
+
- Missing edge case coverage
|
|
198
|
+
|
|
199
|
+
Output: List findings tagged [major], [minor], or [nit] with file:line references."
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
#### Subagent 5: DocScribe
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
Prompt: "Review PR #<number> for documentation and clarity.
|
|
206
|
+
|
|
207
|
+
Read the diff from: /tmp/pr_<number>_diff.txt
|
|
208
|
+
|
|
209
|
+
## Ticket Context
|
|
210
|
+
<ticket title, acceptance criteria, business context>
|
|
211
|
+
|
|
212
|
+
## Historical Context
|
|
213
|
+
<output from thoughts-analyzer>
|
|
214
|
+
|
|
215
|
+
<any additional instructions from user input>
|
|
216
|
+
|
|
217
|
+
## Focus Areas
|
|
218
|
+
- Method and class naming clarity
|
|
219
|
+
- Missing YARD documentation on public interfaces
|
|
220
|
+
- Complex logic lacking explanatory comments
|
|
221
|
+
- Changelog updates for notable changes
|
|
222
|
+
- Misleading or outdated comments
|
|
223
|
+
- Magic numbers or strings needing constants
|
|
224
|
+
|
|
225
|
+
Output: List findings tagged [major], [minor], or [nit] with file:line references."
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Step 5: Merge Results
|
|
229
|
+
|
|
230
|
+
After all subagents complete, compile findings into a unified review.
|
|
231
|
+
|
|
232
|
+
**Critical: Subagents are pattern matchers. You are the judgment layer.** Subagents are designed to be paranoid and thorough — they flag everything that matches their heuristics. Your job is to filter their output, not rubber-stamp it. A [major] from a subagent can become a [nit] or be dropped entirely after applying judgment.
|
|
233
|
+
|
|
234
|
+
For each finding, evaluate:
|
|
235
|
+
- **Real-world probability** — Can this actually happen in practice, or is it purely theoretical? A race condition that requires two users to open a personal link within the same millisecond is not a real issue.
|
|
236
|
+
- **Cost-benefit** — Does the fix add more complexity than the problem warrants? If the "fix" makes the code harder to read without solving a problem a human would encounter, drop it.
|
|
237
|
+
- **Scope** — Review fixes should improve code you're touching, not introduce new artifacts. Clean up, don't build out.
|
|
238
|
+
|
|
239
|
+
Then compile:
|
|
240
|
+
|
|
241
|
+
1. **Group by severity** — [major] first, then [minor], then [nit]
|
|
242
|
+
2. **Remove duplicates** — Multiple agents may flag the same issue
|
|
243
|
+
3. **Add actionable suggestions** — Include code snippets where helpful
|
|
244
|
+
4. **Preserve file:line references** — Format as `app/models/user.rb:42`
|
|
245
|
+
|
|
246
|
+
Determine verdict:
|
|
247
|
+
- **REQUEST_CHANGES** — If any [major] or multiple [minor] issues survive the judgment filter
|
|
248
|
+
- **APPROVE** — If no significant issues remain after filtering
|
|
249
|
+
|
|
250
|
+
### Step 6: Finalize
|
|
251
|
+
|
|
252
|
+
If self-review mode is activated, skip to **Self-review** below.
|
|
253
|
+
|
|
254
|
+
#### Present and Post (review / re-review)
|
|
255
|
+
|
|
256
|
+
Present the merged review to the user, including:
|
|
257
|
+
- PR reference and ticket (if found)
|
|
258
|
+
- Determined verdict
|
|
259
|
+
- All findings grouped by severity
|
|
260
|
+
|
|
261
|
+
Ask the user to confirm: "Shall I post this review to the PR? [Yes/Edit/Cancel]"
|
|
262
|
+
- **Yes** — post the review
|
|
263
|
+
- **Edit** — let the user modify the review, then ask again
|
|
264
|
+
- **Cancel** — discard
|
|
265
|
+
|
|
266
|
+
Once confirmed, post the review:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
gh pr review <PR_NUMBER> --approve --body "<review body>"
|
|
270
|
+
# or
|
|
271
|
+
gh pr review <PR_NUMBER> --request-changes --body "<review body>"
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
#### Self-review
|
|
275
|
+
|
|
276
|
+
Instead of presenting and posting, act on the findings:
|
|
277
|
+
|
|
278
|
+
1. **Fix findings** — Address [major] and [minor] issues directly in code. Apply [nit]s at own discretion.
|
|
279
|
+
2. **Commit and push** — Commit the fixes with a descriptive message and push to the PR branch.
|
|
280
|
+
3. **Assign reviewer** — Assign the user and request review from anyone mentioned in additional instructions.
|
|
281
|
+
4. **Wait for CI** — Monitor CI status. Once green, mark the PR as ready for review.
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
gh pr edit <PR_NUMBER> --add-assignee <user> --add-reviewer <reviewer>
|
|
285
|
+
# once CI is green:
|
|
286
|
+
gh pr ready <PR_NUMBER>
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## Posted Review Format
|
|
290
|
+
|
|
291
|
+
```markdown
|
|
292
|
+
## PR Review Summary
|
|
293
|
+
|
|
294
|
+
**Verdict: REQUEST_CHANGES**
|
|
295
|
+
|
|
296
|
+
### Major Issues
|
|
297
|
+
- `app/models/user.rb:42` - SQL injection via string interpolation in where clause
|
|
298
|
+
```ruby
|
|
299
|
+
# Instead of:
|
|
300
|
+
User.where("name = '#{params[:name]}'")
|
|
301
|
+
# Use:
|
|
302
|
+
User.where(name: params[:name])
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Minor Issues
|
|
306
|
+
- `app/controllers/users_controller.rb:15` - Business logic belongs in model or service
|
|
307
|
+
|
|
308
|
+
### Suggestions
|
|
309
|
+
- `app/services/user_service.rb:8` - Consider more descriptive method name
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
*Review generated with multi-agent analysis*
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
## Guidelines
|
|
316
|
+
|
|
317
|
+
- Focus only on changed lines, not surrounding unchanged code
|
|
318
|
+
- Provide concrete fix suggestions for [major] issues
|
|
319
|
+
- The main agent must never read the diff file — only subagents read it
|
|
320
|
+
- Pass additional instructions from user input through to all subagents
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: thoughts_init
|
|
3
|
+
description: "Initialize the thoughts system for the current repository."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Initialize Thoughts System
|
|
7
|
+
|
|
8
|
+
Initialize the thoughts system for the current repository.
|
|
9
|
+
|
|
10
|
+
## Process
|
|
11
|
+
|
|
12
|
+
### Step 1: Diagnostic Checks
|
|
13
|
+
|
|
14
|
+
Run these checks and collect results:
|
|
15
|
+
|
|
16
|
+
1. `~/thoughts` exists: `test -d "$HOME/thoughts"`
|
|
17
|
+
2. `~/thoughts` is git repo: `test -d "$HOME/thoughts/.git"`
|
|
18
|
+
3. `~/thoughts/global` structure exists: `test -d "$HOME/thoughts/global"`
|
|
19
|
+
4. Scripts exist: `test -x "$HOME/thoughts/bin/thoughts-sync"`
|
|
20
|
+
5. Scripts in PATH: `command -v thoughts-sync >/dev/null 2>&1`
|
|
21
|
+
6. Current dir is git repo: `test -d ".git"`
|
|
22
|
+
7. `./thoughts/shared` symlinked correctly: `test -L "./thoughts/shared" && readlink "./thoughts/shared" | grep -q "thoughts/repos/"`
|
|
23
|
+
|
|
24
|
+
### Step 2: Report or Fix
|
|
25
|
+
|
|
26
|
+
**If all checks pass:**
|
|
27
|
+
```
|
|
28
|
+
Thoughts system ready. Workflow commands will now work correctly.
|
|
29
|
+
|
|
30
|
+
- ~/thoughts: OK (with global/ structure)
|
|
31
|
+
- Scripts: OK (in PATH)
|
|
32
|
+
- Repository: OK (thoughts/shared → ~/thoughts/repos/{repo}/shared)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**If any check fails:**
|
|
36
|
+
Build todo list of what needs fixing, present to user, wait for authorization.
|
|
37
|
+
|
|
38
|
+
### Step 3: Execute Fixes (after authorization)
|
|
39
|
+
|
|
40
|
+
**If ~/thoughts missing:**
|
|
41
|
+
```bash
|
|
42
|
+
mkdir -p "$HOME/thoughts/bin"
|
|
43
|
+
mkdir -p "$HOME/thoughts/global/$(whoami)"
|
|
44
|
+
mkdir -p "$HOME/thoughts/global/shared"
|
|
45
|
+
mkdir -p "$HOME/thoughts/repos"
|
|
46
|
+
git -C "$HOME/thoughts" init
|
|
47
|
+
# Copy thoughts bin scripts from the thoughts repository if available
|
|
48
|
+
chmod +x "$HOME/thoughts/bin/"*
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**If PATH not configured:**
|
|
52
|
+
```bash
|
|
53
|
+
RC_FILE="$HOME/.bashrc"
|
|
54
|
+
[[ "$SHELL" == *"zsh"* ]] && RC_FILE="$HOME/.zshrc"
|
|
55
|
+
echo 'export PATH="$HOME/thoughts/bin:$PATH"' >> "$RC_FILE"
|
|
56
|
+
```
|
|
57
|
+
Tell user to run `source ~/.zshrc` or restart terminal.
|
|
58
|
+
|
|
59
|
+
**If current repo not initialized:**
|
|
60
|
+
```bash
|
|
61
|
+
"$HOME/thoughts/bin/thoughts-init-repo"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Step 4: Verify and Report
|
|
65
|
+
|
|
66
|
+
After fixes, re-run checks and report final status.
|
|
67
|
+
|
|
68
|
+
## Important
|
|
69
|
+
|
|
70
|
+
- Never make changes without user authorization
|
|
71
|
+
- If current directory is not a git repo, report error and stop
|