@yan-geroge/omg 0.1.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.
Files changed (59) hide show
  1. package/.claude/agents/trellis-check.md +109 -0
  2. package/.claude/agents/trellis-implement.md +109 -0
  3. package/.claude/agents/trellis-research.md +137 -0
  4. package/.claude/commands/trellis/continue.md +55 -0
  5. package/.claude/commands/trellis/finish-work.md +66 -0
  6. package/.claude/hooks/inject-subagent-context.py +749 -0
  7. package/.claude/hooks/inject-workflow-state.py +387 -0
  8. package/.claude/hooks/session-start.py +797 -0
  9. package/.claude/settings.json +73 -0
  10. package/.claude/skills/trellis-before-dev/SKILL.md +34 -0
  11. package/.claude/skills/trellis-brainstorm/SKILL.md +548 -0
  12. package/.claude/skills/trellis-break-loop/SKILL.md +130 -0
  13. package/.claude/skills/trellis-check/SKILL.md +92 -0
  14. package/.claude/skills/trellis-meta/SKILL.md +73 -0
  15. package/.claude/skills/trellis-meta/references/customize-local/add-project-local-conventions.md +83 -0
  16. package/.claude/skills/trellis-meta/references/customize-local/change-agents.md +54 -0
  17. package/.claude/skills/trellis-meta/references/customize-local/change-context-loading.md +81 -0
  18. package/.claude/skills/trellis-meta/references/customize-local/change-hooks.md +57 -0
  19. package/.claude/skills/trellis-meta/references/customize-local/change-skills-or-commands.md +78 -0
  20. package/.claude/skills/trellis-meta/references/customize-local/change-spec-structure.md +83 -0
  21. package/.claude/skills/trellis-meta/references/customize-local/change-task-lifecycle.md +90 -0
  22. package/.claude/skills/trellis-meta/references/customize-local/change-workflow.md +64 -0
  23. package/.claude/skills/trellis-meta/references/customize-local/overview.md +55 -0
  24. package/.claude/skills/trellis-meta/references/local-architecture/context-injection.md +68 -0
  25. package/.claude/skills/trellis-meta/references/local-architecture/generated-files.md +80 -0
  26. package/.claude/skills/trellis-meta/references/local-architecture/overview.md +51 -0
  27. package/.claude/skills/trellis-meta/references/local-architecture/spec-system.md +102 -0
  28. package/.claude/skills/trellis-meta/references/local-architecture/task-system.md +101 -0
  29. package/.claude/skills/trellis-meta/references/local-architecture/workflow.md +75 -0
  30. package/.claude/skills/trellis-meta/references/local-architecture/workspace-memory.md +71 -0
  31. package/.claude/skills/trellis-meta/references/platform-files/agents.md +79 -0
  32. package/.claude/skills/trellis-meta/references/platform-files/hooks-and-settings.md +69 -0
  33. package/.claude/skills/trellis-meta/references/platform-files/overview.md +59 -0
  34. package/.claude/skills/trellis-meta/references/platform-files/platform-map.md +74 -0
  35. package/.claude/skills/trellis-meta/references/platform-files/skills-and-commands.md +83 -0
  36. package/.claude/skills/trellis-spec-bootstarp/SKILL.md +41 -0
  37. package/.claude/skills/trellis-spec-bootstarp/references/mcp-setup.md +90 -0
  38. package/.claude/skills/trellis-spec-bootstarp/references/repository-analysis.md +59 -0
  39. package/.claude/skills/trellis-spec-bootstarp/references/spec-task-planning.md +61 -0
  40. package/.claude/skills/trellis-spec-bootstarp/references/spec-writing.md +70 -0
  41. package/.claude/skills/trellis-update-spec/SKILL.md +356 -0
  42. package/CLAUDE.md +88 -0
  43. package/agents/architect.md +80 -0
  44. package/agents/executor.md +79 -0
  45. package/agents/planner.md +76 -0
  46. package/agents/reviewer.md +81 -0
  47. package/agents/tdd-guide.md +95 -0
  48. package/agents/verifier.md +81 -0
  49. package/hooks/keyword-detector.mjs +115 -0
  50. package/hooks/lib/keyword-detector.js +89 -0
  51. package/hooks/session-start.mjs +104 -0
  52. package/marketplace.json +12 -0
  53. package/package.json +34 -0
  54. package/plugin.json +14 -0
  55. package/scripts/diagnose-marketplace.js +84 -0
  56. package/scripts/e2e-diagnose.mjs +118 -0
  57. package/scripts/validate-with-csc-schema.mjs +87 -0
  58. package/skills/costrict-autopilot/SKILL.md +53 -0
  59. package/skills/costrict-team/SKILL.md +65 -0
@@ -0,0 +1,130 @@
1
+ ---
2
+ name: trellis-break-loop
3
+ description: "Deep bug analysis to break the fix-forget-repeat cycle. Analyzes root cause category, why fixes failed, prevention mechanisms, and captures knowledge into specs. Use after fixing a bug to prevent the same class of bugs."
4
+ ---
5
+
6
+ # Break the Loop - Deep Bug Analysis
7
+
8
+ When debug is complete, use this for deep analysis to break the "fix bug -> forget -> repeat" cycle.
9
+
10
+ ---
11
+
12
+ ## Analysis Framework
13
+
14
+ Analyze the bug you just fixed from these 5 dimensions:
15
+
16
+ ### 1. Root Cause Category
17
+
18
+ Which category does this bug belong to?
19
+
20
+ | Category | Characteristics | Example |
21
+ |----------|-----------------|---------|
22
+ | **A. Missing Spec** | No documentation on how to do it | New feature without checklist |
23
+ | **B. Cross-Layer Contract** | Interface between layers unclear | API returns different format than expected |
24
+ | **C. Change Propagation Failure** | Changed one place, missed others | Changed function signature, missed call sites |
25
+ | **D. Test Coverage Gap** | Unit test passes, integration fails | Works alone, breaks when combined |
26
+ | **E. Implicit Assumption** | Code relies on undocumented assumption | Timestamp seconds vs milliseconds |
27
+
28
+ ### 2. Why Fixes Failed (if applicable)
29
+
30
+ If you tried multiple fixes before succeeding, analyze each failure:
31
+
32
+ - **Surface Fix**: Fixed symptom, not root cause
33
+ - **Incomplete Scope**: Found root cause, didn't cover all cases
34
+ - **Tool Limitation**: grep missed it, type check wasn't strict
35
+ - **Mental Model**: Kept looking in same layer, didn't think cross-layer
36
+
37
+ ### 3. Prevention Mechanisms
38
+
39
+ What mechanisms would prevent this from happening again?
40
+
41
+ | Type | Description | Example |
42
+ |------|-------------|---------|
43
+ | **Documentation** | Write it down so people know | Update thinking guide |
44
+ | **Architecture** | Make the error impossible structurally | Type-safe wrappers |
45
+ | **Compile-time** | Strict type checking, no escape hatches | Signature change causes compile error |
46
+ | **Runtime** | Monitoring, alerts, scans | Detect orphan entities |
47
+ | **Test Coverage** | E2E tests, integration tests | Verify full flow |
48
+ | **Code Review** | Checklist, PR template | "Did you check X?" |
49
+
50
+ ### 4. Systematic Expansion
51
+
52
+ What broader problems does this bug reveal?
53
+
54
+ - **Similar Issues**: Where else might this problem exist?
55
+ - **Design Flaw**: Is there a fundamental architecture issue?
56
+ - **Process Flaw**: Is there a development process improvement?
57
+ - **Knowledge Gap**: Is the team missing some understanding?
58
+
59
+ ### 5. Knowledge Capture
60
+
61
+ Solidify insights into the system:
62
+
63
+ - [ ] Update `.trellis/spec/guides/` thinking guides
64
+ - [ ] Update relevant `.trellis/spec/` docs
65
+ - [ ] Create issue record (if applicable)
66
+ - [ ] Create feature ticket for root fix
67
+ - [ ] Update check guidelines if needed
68
+
69
+ ---
70
+
71
+ ## Output Format
72
+
73
+ Please output analysis in this format:
74
+
75
+ ```markdown
76
+ ## Bug Analysis: [Short Description]
77
+
78
+ ### 1. Root Cause Category
79
+ - **Category**: [A/B/C/D/E] - [Category Name]
80
+ - **Specific Cause**: [Detailed description]
81
+
82
+ ### 2. Why Fixes Failed (if applicable)
83
+ 1. [First attempt]: [Why it failed]
84
+ 2. [Second attempt]: [Why it failed]
85
+ ...
86
+
87
+ ### 3. Prevention Mechanisms
88
+ | Priority | Mechanism | Specific Action | Status |
89
+ |----------|-----------|-----------------|--------|
90
+ | P0 | ... | ... | TODO/DONE |
91
+
92
+ ### 4. Systematic Expansion
93
+ - **Similar Issues**: [List places with similar problems]
94
+ - **Design Improvement**: [Architecture-level suggestions]
95
+ - **Process Improvement**: [Development process suggestions]
96
+
97
+ ### 5. Knowledge Capture
98
+ - [ ] [Documents to update / tickets to create]
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Core Philosophy
104
+
105
+ > **The value of debugging is not in fixing the bug, but in making this class of bugs never happen again.**
106
+
107
+ Three levels of insight:
108
+ 1. **Tactical**: How to fix THIS bug
109
+ 2. **Strategic**: How to prevent THIS CLASS of bugs
110
+ 3. **Philosophical**: How to expand thinking patterns
111
+
112
+ 30 minutes of analysis saves 30 hours of future debugging.
113
+
114
+ ---
115
+
116
+ ## After Analysis: Immediate Actions
117
+
118
+ **IMPORTANT**: After completing the analysis above, you MUST immediately:
119
+
120
+ 1. **Update spec/guides** - Don't just list TODOs, actually update the relevant files:
121
+ - If it's a cross-platform issue → update `cross-platform-thinking-guide.md`
122
+ - If it's a cross-layer issue → update `cross-layer-thinking-guide.md`
123
+ - If it's a code reuse issue → update `code-reuse-thinking-guide.md`
124
+ - If it's domain-specific → update `backend/*.md` or `frontend/*.md`
125
+
126
+ 2. **Sync templates** - After updating `.trellis/spec/`, sync to `src/templates/markdown/spec/`
127
+
128
+ 3. **Commit the spec updates** - This is the primary output, not just the analysis text
129
+
130
+ > **The analysis is worthless if it stays in chat. The value is in the updated specs.**
@@ -0,0 +1,92 @@
1
+ ---
2
+ name: trellis-check
3
+ description: "Comprehensive quality verification: spec compliance, lint, type-check, tests, cross-layer data flow, code reuse, and consistency checks. Use when code is written and needs quality verification, before committing changes, or to catch context drift during long sessions."
4
+ ---
5
+
6
+ # Code Quality Check
7
+
8
+ Comprehensive quality verification for recently written code. Combines spec compliance, cross-layer safety, and pre-commit checks.
9
+
10
+ ---
11
+
12
+ ## Step 1: Identify What Changed
13
+
14
+ ```bash
15
+ git diff --name-only HEAD
16
+ git status
17
+ ```
18
+
19
+ ## Step 2: Read Applicable Specs
20
+
21
+ ```bash
22
+ python ./.trellis/scripts/get_context.py --mode packages
23
+ ```
24
+
25
+ For each changed package/layer, read the spec index and follow its **Quality Check** section:
26
+
27
+ ```bash
28
+ cat .trellis/spec/<package>/<layer>/index.md
29
+ ```
30
+
31
+ Read the specific guideline files referenced — the index is a pointer, not the goal.
32
+
33
+ ## Step 3: Run Project Checks
34
+
35
+ Run the project's lint, type-check, and test commands. Fix any failures before proceeding.
36
+
37
+ ## Step 4: Review Against Checklist
38
+
39
+ ### Code Quality
40
+
41
+ - [ ] Linter passes?
42
+ - [ ] Type checker passes (if applicable)?
43
+ - [ ] Tests pass?
44
+ - [ ] No debug logging left in?
45
+ - [ ] No suppressed warnings or type-safety bypasses?
46
+
47
+ ### Test Coverage
48
+
49
+ - [ ] New function → unit test added?
50
+ - [ ] Bug fix → regression test added?
51
+ - [ ] Changed behavior → existing tests updated?
52
+
53
+ ### Spec Sync
54
+
55
+ - [ ] Does `.trellis/spec/` need updates? (new patterns, conventions, lessons learned)
56
+
57
+ > "If I fixed a bug or discovered something non-obvious, should I document it so future me won't hit the same issue?" → If YES, update the relevant spec doc.
58
+
59
+ ## Step 5: Cross-Layer Dimensions (if applicable)
60
+
61
+ Skip this step if your change is confined to a single layer.
62
+
63
+ ### A. Data Flow (changes touch 3+ layers)
64
+
65
+ - [ ] Read flow traces correctly: Storage → Service → API → UI
66
+ - [ ] Write flow traces correctly: UI → API → Service → Storage
67
+ - [ ] Types/schemas correctly passed between layers?
68
+ - [ ] Errors properly propagated to caller?
69
+
70
+ ### B. Code Reuse (modifying constants, creating utilities)
71
+
72
+ - [ ] Searched for existing similar code before creating new?
73
+ ```bash
74
+ grep -r "pattern" src/
75
+ ```
76
+ - [ ] If 2+ places define same value → extracted to shared constant?
77
+ - [ ] After batch modification, all occurrences updated?
78
+
79
+ ### C. Import/Dependency (creating new files)
80
+
81
+ - [ ] Correct import paths (relative vs absolute)?
82
+ - [ ] No circular dependencies?
83
+
84
+ ### D. Same-Layer Consistency
85
+
86
+ - [ ] Other places using the same concept are consistent?
87
+
88
+ ---
89
+
90
+ ## Step 6: Report and Fix
91
+
92
+ Report violations found and fix them directly. Re-run project checks after fixes.
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: trellis-meta
3
+ description: "Understand and customize the local Trellis architecture inside a user project. Use when modifying .trellis plus platform hooks, settings, agents, skills, commands, prompts, or workflows generated by trellis init."
4
+ ---
5
+
6
+ # Trellis Meta
7
+
8
+ This skill is for local Trellis users who have already run `trellis init` in a project. After reading it, an AI should understand the Trellis architecture, operating model, and customization entry points inside that user project, then modify the generated `.trellis/` and platform directory files according to the user's request.
9
+
10
+ The default operating scope is local files in the user project:
11
+
12
+ - `.trellis/`: workflow, config, tasks, spec, workspace, scripts, and runtime state.
13
+ - Platform directories: `.claude/`, `.codex/`, `.cursor/`, `.opencode/`, `.kiro/`, `.gemini/`, `.qoder/`, `.codebuddy/`, `.github/`, `.factory/`, `.pi/`, `.kilocode/`, `.agent/`, `.windsurf/`, and similar directories.
14
+ - Shared skill layer: `.agents/skills/`.
15
+
16
+ Do not assume the user has the Trellis source repository. Do not default to modifying the global npm install directory or `node_modules`.
17
+
18
+ ## How To Use
19
+
20
+ 1. Read `references/local-architecture/overview.md` first to establish the local Trellis system model.
21
+ 2. If the request involves a specific AI tool, read `references/platform-files/platform-map.md` and the relevant platform file notes.
22
+ 3. If the user wants to change behavior, read `references/customize-local/overview.md`, then open the specific customization topic.
23
+ 4. Before editing, read the actual files in the user project and treat local content as authoritative.
24
+
25
+ ## References
26
+
27
+ ### Local Architecture
28
+
29
+ - `references/local-architecture/overview.md`: The three-layer local Trellis architecture and customization principles.
30
+ - `references/local-architecture/generated-files.md`: Files generated by `trellis init` and their customization boundaries.
31
+ - `references/local-architecture/workflow.md`: Phases, routing, and workflow-state blocks in `.trellis/workflow.md`.
32
+ - `references/local-architecture/task-system.md`: Task directories, active tasks, JSONL context, and task runtime.
33
+ - `references/local-architecture/spec-system.md`: How `.trellis/spec/` is organized and injected.
34
+ - `references/local-architecture/workspace-memory.md`: `.trellis/workspace/`, journals, and cross-session memory.
35
+ - `references/local-architecture/context-injection.md`: Hooks, sub-agent preludes, and context injection paths.
36
+
37
+ ### Platform Files
38
+
39
+ - `references/platform-files/overview.md`: How shared `.trellis/` files relate to platform directories.
40
+ - `references/platform-files/platform-map.md`: Platform directories and paths for skills, agents, hooks, and extensions.
41
+ - `references/platform-files/hooks-and-settings.md`: How settings/config files, hooks, plugins, and extensions connect to Trellis.
42
+ - `references/platform-files/agents.md`: Local file responsibilities for `trellis-research`, `trellis-implement`, and `trellis-check`.
43
+ - `references/platform-files/skills-and-commands.md`: Differences between skills, commands, prompts, and workflows, plus how to change them.
44
+
45
+ ### Local Customization
46
+
47
+ - `references/customize-local/overview.md`: Choose the right local customization entry point for the user's request.
48
+ - `references/customize-local/change-workflow.md`: Change phases, routing, next actions, and workflow-state.
49
+ - `references/customize-local/change-task-lifecycle.md`: Change task creation, status, archive behavior, and hooks.
50
+ - `references/customize-local/change-context-loading.md`: Change how tasks, specs, journals, and hook context are loaded.
51
+ - `references/customize-local/change-hooks.md`: Change platform hooks, settings, and shell session bridges.
52
+ - `references/customize-local/change-agents.md`: Change research, implement, and check agent behavior.
53
+ - `references/customize-local/change-skills-or-commands.md`: Add or modify local skills, commands, prompts, and workflows.
54
+ - `references/customize-local/change-spec-structure.md`: Adjust the project spec structure under `.trellis/spec/`.
55
+ - `references/customize-local/add-project-local-conventions.md`: Put team rules into project-local specs or local skills.
56
+
57
+ ## Current Rules
58
+
59
+ - `.trellis/workflow.md` is the local workflow source of truth.
60
+ - `.trellis/config.yaml` is the project-level Trellis configuration and task hook configuration entry point.
61
+ - `.trellis/spec/` stores the user's project-specific coding conventions and design constraints.
62
+ - `.trellis/tasks/` stores task PRDs, technical notes, research files, and JSONL context.
63
+ - `.trellis/workspace/` stores developer journals and cross-session memory.
64
+ - Platform settings/config files decide which hooks, agents, skills, commands, prompts, and workflows actually run.
65
+ - `.trellis/.template-hashes.json` and `.trellis/.runtime/` are management/runtime state files. Confirm necessity before editing them.
66
+
67
+ ## Do Not
68
+
69
+ - Do not treat Trellis upstream source code as the default target for local customization.
70
+ - Do not modify the global npm install directory or `node_modules/@mindfoldhq/trellis` to implement project needs.
71
+ - Do not overwrite user-modified local files with default templates.
72
+ - Do not put team-private project rules into the public `trellis-meta`; put project rules in `.trellis/spec/` or a project-local skill.
73
+ - Do not describe removed historical mechanisms as current Trellis behavior.
@@ -0,0 +1,83 @@
1
+ # Add Project-Local Conventions
2
+
3
+ Often the user does not need to change Trellis mechanics; they need local AI to understand their team's conventions. In that case, prefer `.trellis/spec/` or a project-local skill instead of editing `trellis-meta`.
4
+
5
+ ## Where To Put Things
6
+
7
+ | Content type | Location |
8
+ | --- | --- |
9
+ | Rules code must follow | `.trellis/spec/<layer>/` |
10
+ | Cross-layer thinking methods | `.trellis/spec/guides/` |
11
+ | AI capability for a project-specific flow | Platform-local skill |
12
+ | One-off task material | `.trellis/tasks/<task>/` |
13
+ | Session summary | `.trellis/workspace/<developer>/journal-N.md` |
14
+
15
+ ## Create A Project-Local Skill
16
+
17
+ If the user wants AI to know "how this project customizes Trellis," create a local skill:
18
+
19
+ ```text
20
+ .claude/skills/trellis-local/
21
+ └── SKILL.md
22
+ ```
23
+
24
+ Example:
25
+
26
+ ```md
27
+ ---
28
+ name: trellis-local
29
+ description: "Project-local Trellis customizations for this repository. Use when changing this project's Trellis workflow, hooks, local agents, or team-specific conventions."
30
+ ---
31
+
32
+ # Trellis Local
33
+
34
+ ## Local Scope
35
+
36
+ This skill documents this repository's Trellis customizations only.
37
+
38
+ ## Custom Workflow Rules
39
+
40
+ - ...
41
+
42
+ ## Local Hook Changes
43
+
44
+ - ...
45
+
46
+ ## Local Agent Changes
47
+
48
+ - ...
49
+ ```
50
+
51
+ For multi-platform projects, place equivalent versions in other platform skill directories, or use `.agents/skills/` for platforms that support the shared layer.
52
+
53
+ ## Write To `.trellis/spec/`
54
+
55
+ If the content is a coding convention, write it to spec. Examples:
56
+
57
+ ```text
58
+ .trellis/spec/backend/error-handling.md
59
+ .trellis/spec/frontend/components.md
60
+ .trellis/spec/guides/cross-platform-thinking-guide.md
61
+ ```
62
+
63
+ After writing it, update the corresponding `index.md` so AI can find the new rule from the entry point.
64
+
65
+ ## Make The Current Task Use New Conventions
66
+
67
+ After writing a spec, add it to the current task context:
68
+
69
+ ```bash
70
+ python ./.trellis/scripts/task.py add-context <task> implement ".trellis/spec/backend/error-handling.md" "Error handling conventions"
71
+ python ./.trellis/scripts/task.py add-context <task> check ".trellis/spec/backend/error-handling.md" "Review error handling"
72
+ ```
73
+
74
+ ## Do Not Store Project-Private Rules In `trellis-meta`
75
+
76
+ `trellis-meta` is a public skill for understanding Trellis architecture and local customization entry points. Put project-private content in:
77
+
78
+ - `.trellis/spec/`
79
+ - a project-local skill
80
+ - the current task
81
+ - workspace journal
82
+
83
+ This prevents future updates to Trellis's built-in `trellis-meta` from overwriting the team's own conventions.
@@ -0,0 +1,54 @@
1
+ # Change Local Agents
2
+
3
+ When the user wants to change `trellis-research`, `trellis-implement`, or `trellis-check` behavior, edit platform agent files in the user project.
4
+
5
+ ## Read These Files First
6
+
7
+ 1. Target platform agent directory
8
+ 2. `.trellis/workflow.md` Phase 2 / research routing
9
+ 3. Current task `prd.md`
10
+ 4. Current task `implement.jsonl` / `check.jsonl`
11
+ 5. Relevant hook or agent prelude
12
+
13
+ ## Common Paths
14
+
15
+ | Platform | Path |
16
+ | --- | --- |
17
+ | Claude Code | `.claude/agents/trellis-*.md` |
18
+ | Cursor | `.cursor/agents/trellis-*.md` |
19
+ | OpenCode | `.opencode/agents/trellis-*.md` |
20
+ | Codex | `.codex/agents/trellis-*.toml` |
21
+ | Kiro | `.kiro/agents/trellis-*.json` |
22
+ | Gemini CLI | `.gemini/agents/trellis-*.md` |
23
+ | Qoder | `.qoder/agents/trellis-*.md` |
24
+ | CodeBuddy | `.codebuddy/agents/trellis-*.md` |
25
+ | Factory Droid | `.factory/droids/trellis-*.md` |
26
+ | Pi Agent | `.pi/agents/trellis-*.md` |
27
+
28
+ Use the actual paths in the user project as authoritative.
29
+
30
+ ## Common Needs
31
+
32
+ | Need | Which agent to edit |
33
+ | --- | --- |
34
+ | Research must write files, not only reply in chat | `trellis-research` |
35
+ | Certain local specs must be read before implementation | `trellis-implement` + `implement.jsonl` configuration rules |
36
+ | Specific commands must run during checking | `trellis-check` |
37
+ | Agent must not modify certain directories | The corresponding agent's write boundary instructions |
38
+ | Agent output format must be fixed | The corresponding agent's final/reporting instructions |
39
+
40
+ ## Modification Principles
41
+
42
+ 1. **Preserve role boundaries**: research investigates and persists; implement writes implementation; check reviews and fixes.
43
+ 2. **Do not hard-code project specs into agents**: long-term specs belong in `.trellis/spec/`; agents are responsible for reading them.
44
+ 3. **Make read order explicit**: active task -> PRD -> info -> JSONL -> spec/research.
45
+ 4. **Make write boundaries explicit**: which directories may be written and which may not.
46
+ 5. **Synchronize across platforms**: when the user configured multiple platforms, decide whether to change only the current platform or all platform agents.
47
+
48
+ ## Agent Pull Platforms
49
+
50
+ If an agent file contains a prelude for "read task/context after startup," do not remove those steps when editing. Otherwise the agent will work only from chat context and bypass Trellis's core mechanism.
51
+
52
+ ## Hook Push Platforms
53
+
54
+ If context is injected by a hook, the agent file should still retain responsibility boundaries. Do not remove PRD/spec requirements from the agent just because a hook injects context.
@@ -0,0 +1,81 @@
1
+ # Change Local Context Loading
2
+
3
+ Context loading determines when AI reads workflow, task, spec, research, workspace, and git status. Read this page when the user says "AI does not know the current task," "the agent did not read specs," or "there is too much/too little context."
4
+
5
+ ## Read These Files First
6
+
7
+ 1. `.trellis/workflow.md`
8
+ 2. `.trellis/scripts/get_context.py`
9
+ 3. `.trellis/scripts/common/session_context.py`
10
+ 4. `.trellis/scripts/common/task_context.py`
11
+ 5. `.trellis/scripts/common/active_task.py`
12
+ 6. Current platform hooks or agent files
13
+ 7. The current task's `implement.jsonl` / `check.jsonl`
14
+
15
+ ## Context Sources
16
+
17
+ | Source | Purpose |
18
+ | --- | --- |
19
+ | `.trellis/workflow.md` | Workflow and next-action hints. |
20
+ | `.trellis/tasks/<task>/prd.md` | Current task requirements. |
21
+ | `.trellis/tasks/<task>/implement.jsonl` | Spec/research to read before implementation. |
22
+ | `.trellis/tasks/<task>/check.jsonl` | Spec/research to read during checking. |
23
+ | `.trellis/spec/` | Project specs. |
24
+ | `.trellis/workspace/` | Session records. |
25
+ | git status | Current working tree changes. |
26
+
27
+ ## Common Needs And Edit Points
28
+
29
+ | Need | Edit point |
30
+ | --- | --- |
31
+ | Inject more/less information in new sessions | `session_context.py` or the platform `session-start` hook. |
32
+ | Change hints on each user input | `[workflow-state:STATUS]` block in `.trellis/workflow.md`. The `inject-workflow-state` hook is parser-only and reads the block verbatim. |
33
+ | Agent did not read specs | Task JSONL, agent prelude, `inject-subagent-context` hook. |
34
+ | Active task is lost | `active_task.py` and platform session identity propagation. |
35
+ | Change JSONL validation rules | `task_context.py`. |
36
+
37
+ ## JSONL Rules
38
+
39
+ `implement.jsonl` / `check.jsonl` are the key context loading interface:
40
+
41
+ ```jsonl
42
+ {"file": ".trellis/spec/backend/index.md", "reason": "Backend conventions"}
43
+ {"file": ".trellis/tasks/04-28-x/research/api.md", "reason": "API research"}
44
+ ```
45
+
46
+ Include only spec/research files. Do not put code files that will be modified into these manifests; agents read code files themselves during implementation.
47
+
48
+ ## Change Session Context
49
+
50
+ If the user wants every new session to see more project state, edit:
51
+
52
+ - `.trellis/scripts/common/session_context.py`
53
+ - the corresponding platform `session-start` hook
54
+
55
+ Context cannot grow without bound. Prefer injecting indexes and paths so the AI can read detailed files on demand.
56
+
57
+ ## Change Sub-Agent Context
58
+
59
+ First determine which mode the platform uses:
60
+
61
+ - hook push: edit the `inject-subagent-context` hook.
62
+ - agent pull: edit the read steps in the corresponding `trellis-implement` / `trellis-check` agent file.
63
+
64
+ In both modes, make sure the agent ultimately reads:
65
+
66
+ 1. active task
67
+ 2. `prd.md`
68
+ 3. `info.md` if present
69
+ 4. the corresponding JSONL
70
+ 5. spec/research referenced by the JSONL
71
+
72
+ ## Troubleshooting Order
73
+
74
+ ```bash
75
+ python ./.trellis/scripts/task.py current --source
76
+ python ./.trellis/scripts/task.py list-context <task>
77
+ python ./.trellis/scripts/task.py validate <task>
78
+ python ./.trellis/scripts/get_context.py --mode packages
79
+ ```
80
+
81
+ Confirm the task and JSONL are correct before editing hooks/agents.
@@ -0,0 +1,57 @@
1
+ # Change Local Hooks
2
+
3
+ Hooks are the automation layer that connects a platform to Trellis. When the user wants to change "when context is injected," "how shell commands inherit a session," or "which files are read before an agent starts," hooks are usually the edit point.
4
+
5
+ ## Read These Files First
6
+
7
+ 1. Target platform settings/config, such as `.claude/settings.json`, `.codex/hooks.json`, `.cursor/hooks.json`
8
+ 2. Target platform hooks directory
9
+ 3. `.trellis/scripts/common/active_task.py`
10
+ 4. `.trellis/scripts/common/session_context.py`
11
+ 5. `.trellis/workflow.md`
12
+
13
+ ## Common Hook Types
14
+
15
+ | Hook | Purpose |
16
+ | --- | --- |
17
+ | session-start | Injects a Trellis overview when a session starts, clears, or compacts. |
18
+ | workflow-state | Injects a state hint on each user input. |
19
+ | sub-agent context | Injects PRD/spec/research before an agent starts. |
20
+ | shell session bridge | Lets `task.py` commands in shell see the same session identity. |
21
+
22
+ ## Modification Steps
23
+
24
+ 1. Find the hook registration in settings/config.
25
+ 2. Confirm the registered script path exists.
26
+ 3. Read the hook script and identify inputs, outputs, and called `.trellis/scripts/`.
27
+ 4. Modify hook behavior.
28
+ 5. If the hook depends on workflow content, synchronize `.trellis/workflow.md`.
29
+
30
+ ## Example: Change New-Session Injection Content
31
+
32
+ First find the session-start hook:
33
+
34
+ ```text
35
+ .claude/settings.json
36
+ .claude/hooks/session-start.py
37
+ ```
38
+
39
+ If the hook ultimately calls `.trellis/scripts/get_context.py` or `session_context.py`, editing the local script is usually more robust than hard-coding content in the hook.
40
+
41
+ ## Example: Agent Did Not Read JSONL
42
+
43
+ First confirm:
44
+
45
+ ```bash
46
+ python ./.trellis/scripts/task.py current --source
47
+ python ./.trellis/scripts/task.py validate <task>
48
+ ```
49
+
50
+ If the task and JSONL are correct, determine whether the platform uses hook push or agent pull. For hook push, edit `inject-subagent-context`; for agent pull, edit the agent file.
51
+
52
+ ## Notes
53
+
54
+ - Settings handle registration, hook scripts handle behavior; inspect both together.
55
+ - Different platforms support different hook events. Do not directly copy another platform's settings.
56
+ - Hooks should read project-local `.trellis/`; they should not depend on Trellis upstream source paths.
57
+ - Hook failures should produce visible errors so AI does not silently lose context.
@@ -0,0 +1,78 @@
1
+ # Change Local Skills, Commands, Prompts, And Workflows
2
+
3
+ When the user wants to change AI entry points, auto-trigger rules, or explicit command behavior, edit skills, commands, prompts, or workflows in local platform directories.
4
+
5
+ ## Read These Files First
6
+
7
+ 1. `.trellis/workflow.md`
8
+ 2. Target platform skill/command/prompt/workflow directory
9
+ 3. Related agent or hook files
10
+ 4. Whether project rules already exist in `.trellis/spec/`
11
+
12
+ ## Which Entry Type To Choose
13
+
14
+ | Goal | Recommendation |
15
+ | --- | --- |
16
+ | AI should automatically know a capability | Add or modify a skill. |
17
+ | User wants to trigger manually with a command | Add or modify a command/prompt/workflow. |
18
+ | Team project conventions | Prefer `.trellis/spec/` or a project-local skill. |
19
+ | Change Trellis flow semantics | Synchronize `.trellis/workflow.md`. |
20
+
21
+ ## Modify A Skill
22
+
23
+ A skill is usually:
24
+
25
+ ```text
26
+ <skill-name>/
27
+ ├── SKILL.md
28
+ └── references/
29
+ ```
30
+
31
+ `SKILL.md` should be short and responsible for triggering/routing. Put long content in `references/` so AI can read it on demand.
32
+
33
+ The frontmatter description should specify when to use the skill. Example:
34
+
35
+ ```yaml
36
+ description: "Use when customizing this project's deployment workflow and release checklist."
37
+ ```
38
+
39
+ Do not write vague descriptions such as "helpful project skill"; they can trigger incorrectly.
40
+
41
+ ## Modify A Command/Prompt/Workflow
42
+
43
+ Explicit entry points should state:
44
+
45
+ - How the user triggers it.
46
+ - Which `.trellis/` files to read.
47
+ - Which scripts to run.
48
+ - How to report after completion.
49
+
50
+ If a command only repeats workflow rules, prefer making it reference/read `.trellis/workflow.md` instead of maintaining a second copy of the flow.
51
+
52
+ ## Common Paths
53
+
54
+ | Platform | Entry directories |
55
+ | --- | --- |
56
+ | Claude Code | `.claude/skills/`, `.claude/commands/` |
57
+ | Cursor | `.cursor/skills/`, `.cursor/commands/` |
58
+ | OpenCode | `.opencode/skills/`, `.opencode/commands/` |
59
+ | Codex | `.agents/skills/`, `.codex/skills/` |
60
+ | GitHub Copilot | `.github/skills/`, `.github/prompts/` |
61
+ | Kilo / Antigravity / Windsurf | workflows + skills |
62
+
63
+ ## Add A Project-Local Skill
64
+
65
+ If the user wants to document team-private customizations, create a project-local skill, for example:
66
+
67
+ ```text
68
+ .claude/skills/project-trellis-local/
69
+ └── SKILL.md
70
+ ```
71
+
72
+ For multi-platform projects, add equivalent versions in each platform skill directory, or use `.agents/skills/` on platforms that support the shared layer.
73
+
74
+ ## Notes
75
+
76
+ - Do not mix every platform's syntax into one file.
77
+ - Do not change only one platform entry point while claiming all platforms are supported.
78
+ - Do not hide long-term engineering conventions inside a command; write them to `.trellis/spec/`.