@mindfoldhq/trellis 0.5.0-beta.16 → 0.5.0-beta.17
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.
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +0 -28
- package/dist/commands/init.js.map +1 -1
- package/dist/configurators/antigravity.d.ts.map +1 -1
- package/dist/configurators/antigravity.js +2 -8
- package/dist/configurators/antigravity.js.map +1 -1
- package/dist/configurators/claude.d.ts.map +1 -1
- package/dist/configurators/claude.js +3 -9
- package/dist/configurators/claude.js.map +1 -1
- package/dist/configurators/codebuddy.d.ts.map +1 -1
- package/dist/configurators/codebuddy.js +2 -2
- package/dist/configurators/codebuddy.js.map +1 -1
- package/dist/configurators/codex.d.ts.map +1 -1
- package/dist/configurators/codex.js +2 -7
- package/dist/configurators/codex.js.map +1 -1
- package/dist/configurators/copilot.d.ts.map +1 -1
- package/dist/configurators/copilot.js +2 -9
- package/dist/configurators/copilot.js.map +1 -1
- package/dist/configurators/cursor.d.ts.map +1 -1
- package/dist/configurators/cursor.js +2 -2
- package/dist/configurators/cursor.js.map +1 -1
- package/dist/configurators/droid.d.ts.map +1 -1
- package/dist/configurators/droid.js +2 -2
- package/dist/configurators/droid.js.map +1 -1
- package/dist/configurators/gemini.d.ts.map +1 -1
- package/dist/configurators/gemini.js +2 -2
- package/dist/configurators/gemini.js.map +1 -1
- package/dist/configurators/index.d.ts.map +1 -1
- package/dist/configurators/index.js +13 -11
- package/dist/configurators/index.js.map +1 -1
- package/dist/configurators/kilo.d.ts.map +1 -1
- package/dist/configurators/kilo.js +2 -8
- package/dist/configurators/kilo.js.map +1 -1
- package/dist/configurators/kiro.d.ts.map +1 -1
- package/dist/configurators/kiro.js +2 -2
- package/dist/configurators/kiro.js.map +1 -1
- package/dist/configurators/opencode.d.ts.map +1 -1
- package/dist/configurators/opencode.js +3 -3
- package/dist/configurators/opencode.js.map +1 -1
- package/dist/configurators/pi.d.ts.map +1 -1
- package/dist/configurators/pi.js +9 -4
- package/dist/configurators/pi.js.map +1 -1
- package/dist/configurators/qoder.d.ts.map +1 -1
- package/dist/configurators/qoder.js +2 -2
- package/dist/configurators/qoder.js.map +1 -1
- package/dist/configurators/shared.d.ts +21 -2
- package/dist/configurators/shared.d.ts.map +1 -1
- package/dist/configurators/shared.js +32 -3
- package/dist/configurators/shared.js.map +1 -1
- package/dist/configurators/windsurf.d.ts.map +1 -1
- package/dist/configurators/windsurf.js +2 -8
- package/dist/configurators/windsurf.js.map +1 -1
- package/dist/migrations/manifests/0.5.0-beta.17.json +9 -0
- package/dist/templates/common/bundled-skills/trellis-meta/SKILL.md +73 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/add-project-local-conventions.md +83 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-agents.md +54 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-context-loading.md +81 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-hooks.md +57 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-skills-or-commands.md +78 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-spec-structure.md +83 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-task-lifecycle.md +79 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-workflow.md +48 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/overview.md +55 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/context-injection.md +68 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/generated-files.md +80 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/overview.md +51 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/spec-system.md +102 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/task-system.md +101 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workflow.md +75 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workspace-memory.md +71 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/agents.md +79 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/hooks-and-settings.md +69 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/overview.md +59 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/platform-map.md +74 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/skills-and-commands.md +83 -0
- package/dist/templates/common/index.d.ts +22 -2
- package/dist/templates/common/index.d.ts.map +1 -1
- package/dist/templates/common/index.js +53 -4
- package/dist/templates/common/index.js.map +1 -1
- package/dist/templates/common/skills/brainstorm.md +3 -0
- package/dist/templates/markdown/agents.md +8 -0
- package/dist/templates/pi/extensions/trellis/index.ts.txt +499 -51
- package/dist/templates/trellis/workflow.md +3 -0
- package/package.json +1 -1
package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/overview.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Local Customization Overview
|
|
2
|
+
|
|
3
|
+
This directory is for local AI working in a user project where Trellis was installed through npm and `trellis init` has already been run. The AI should modify generated `.trellis/` and platform directories inside the project, not Trellis CLI upstream source code.
|
|
4
|
+
|
|
5
|
+
## First Determine What The User Actually Wants To Change
|
|
6
|
+
|
|
7
|
+
| User wording | Read first |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| "Change the Trellis flow / phases / next prompt" | `change-workflow.md` |
|
|
10
|
+
| "Change task creation, status, archive, or hooks" | `change-task-lifecycle.md` |
|
|
11
|
+
| "AI did not read context / change injected content" | `change-context-loading.md` |
|
|
12
|
+
| "A platform hook is not behaving as expected" | `change-hooks.md` |
|
|
13
|
+
| "Change implement/check/research agent behavior" | `change-agents.md` |
|
|
14
|
+
| "Add a skill/command/workflow/prompt" | `change-skills-or-commands.md` |
|
|
15
|
+
| "Adjust the project spec structure" | `change-spec-structure.md` |
|
|
16
|
+
| "Add team conventions and local notes" | `add-project-local-conventions.md` |
|
|
17
|
+
|
|
18
|
+
## General Operation Order
|
|
19
|
+
|
|
20
|
+
1. **Confirm platform and directories**: inspect which directories exist, such as `.claude/`, `.codex/`, `.cursor/`.
|
|
21
|
+
2. **Confirm the current active task**: run `python3 ./.trellis/scripts/task.py current --source`.
|
|
22
|
+
3. **Read the local source of truth**: prefer `.trellis/workflow.md`, `.trellis/config.yaml`, and relevant platform files.
|
|
23
|
+
4. **Modify narrowly**: edit only files related to the user's request.
|
|
24
|
+
5. **Synchronize semantics**: if a shared flow changes, check whether platform entry points also need changes; if a platform entry changes, check whether `.trellis/workflow.md` still agrees.
|
|
25
|
+
|
|
26
|
+
## Local File Priority
|
|
27
|
+
|
|
28
|
+
| Layer | Files |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| Workflow | `.trellis/workflow.md` |
|
|
31
|
+
| Project configuration | `.trellis/config.yaml` |
|
|
32
|
+
| Task material | `.trellis/tasks/<task>/` |
|
|
33
|
+
| Project specs | `.trellis/spec/` |
|
|
34
|
+
| Runtime scripts | `.trellis/scripts/` |
|
|
35
|
+
| Platform integration | `.claude/`, `.codex/`, `.cursor/`, `.opencode/`, and similar directories |
|
|
36
|
+
| Shared skill | `.agents/skills/` |
|
|
37
|
+
|
|
38
|
+
## Things Not To Do By Default
|
|
39
|
+
|
|
40
|
+
- Do not edit the global npm install directory.
|
|
41
|
+
- Do not edit `node_modules/@mindfoldhq/trellis`.
|
|
42
|
+
- Do not assume the user has the Trellis GitHub repository.
|
|
43
|
+
- Do not overwrite local files already modified by the user with default templates.
|
|
44
|
+
- Do not put team project rules into public `trellis-meta`; project rules belong in `.trellis/spec/` or a local skill.
|
|
45
|
+
|
|
46
|
+
## When To Inspect Upstream Source
|
|
47
|
+
|
|
48
|
+
Switch to an upstream source-code perspective only when the user explicitly expresses one of these goals:
|
|
49
|
+
|
|
50
|
+
- "I want to open a PR to Trellis"
|
|
51
|
+
- "I want to change npm package publish contents"
|
|
52
|
+
- "I want to fork Trellis"
|
|
53
|
+
- "I want to modify the generation logic for `trellis init/update`"
|
|
54
|
+
|
|
55
|
+
Otherwise, default to modifying local Trellis files inside the user project.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Local Context Injection System
|
|
2
|
+
|
|
3
|
+
Trellis context injection aims to make AI read the right files at the right time instead of relying on model memory. In a user project, injection is implemented by `.trellis/` scripts together with platform hooks, agents, and skills.
|
|
4
|
+
|
|
5
|
+
## Injected Context Types
|
|
6
|
+
|
|
7
|
+
| Type | Source | Purpose |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| session context | `.trellis/scripts/get_context.py` | Current developer, git status, active task, active tasks, journal, packages. |
|
|
10
|
+
| workflow context | `.trellis/workflow.md` | Current Trellis flow and next action. |
|
|
11
|
+
| spec context | `.trellis/spec/` + task JSONL | Specs that must be followed during implementation/checking. |
|
|
12
|
+
| task context | `.trellis/tasks/<task>/prd.md`, `info.md`, `research/` | Current task requirements, design, and research. |
|
|
13
|
+
| platform context | Platform hooks/settings/agents | Lets different AI tools read the files above through their own mechanisms. |
|
|
14
|
+
|
|
15
|
+
## session-start
|
|
16
|
+
|
|
17
|
+
Platforms with session-start support inject a Trellis overview when a session starts, clears, compacts, or receives a similar event. Injected content usually includes:
|
|
18
|
+
|
|
19
|
+
- workflow summary.
|
|
20
|
+
- current task status.
|
|
21
|
+
- active tasks.
|
|
22
|
+
- spec index paths.
|
|
23
|
+
- developer identity and git status.
|
|
24
|
+
|
|
25
|
+
If the user feels the AI does not know the current task in a new session, first check whether the platform's session-start hook or equivalent mechanism is installed and running.
|
|
26
|
+
|
|
27
|
+
## workflow-state
|
|
28
|
+
|
|
29
|
+
workflow-state is a lightweight hint injected around each user turn. Based on current task status, it selects a block from `.trellis/workflow.md`, such as `no_task`, `planning`, `in_progress`, or `completed`.
|
|
30
|
+
|
|
31
|
+
If the user wants to change "what the AI should do next in a given state," edit the corresponding state block in `.trellis/workflow.md` first.
|
|
32
|
+
|
|
33
|
+
## sub-agent context
|
|
34
|
+
|
|
35
|
+
Implement and check agents need task context. Trellis has two loading modes:
|
|
36
|
+
|
|
37
|
+
1. **hook push**: a platform hook injects `prd.md` and the files referenced by `implement.jsonl` / `check.jsonl` before the agent starts.
|
|
38
|
+
2. **agent pull**: the agent definition instructs the agent to read the active task, PRD, and JSONL context after startup.
|
|
39
|
+
|
|
40
|
+
In both modes, JSONL files in the task directory are the key interface.
|
|
41
|
+
|
|
42
|
+
## JSONL Reading Rules
|
|
43
|
+
|
|
44
|
+
`implement.jsonl` and `check.jsonl` contain one JSON object per line:
|
|
45
|
+
|
|
46
|
+
```jsonl
|
|
47
|
+
{"file": ".trellis/spec/backend/index.md", "reason": "Backend rules"}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Readers should skip seed rows without a `file` field. When configuring JSONL, the AI should include only spec/research files, not pre-register code files that will be modified.
|
|
51
|
+
|
|
52
|
+
## Active Task And Context Key
|
|
53
|
+
|
|
54
|
+
Active task state lives in `.trellis/.runtime/sessions/` and is isolated per session. Hooks try to resolve the context key from platform events, environment variables, transcript paths, or `TRELLIS_CONTEXT_ID`.
|
|
55
|
+
|
|
56
|
+
If shell commands cannot see the same context key, `task.py current --source` may report no active task. In that case, check whether the platform passes session identity into the shell instead of hand-writing a global current-task file.
|
|
57
|
+
|
|
58
|
+
## Local Customization Points
|
|
59
|
+
|
|
60
|
+
| Need | Edit location |
|
|
61
|
+
| --- | --- |
|
|
62
|
+
| Change session-start injected content | The platform's `session-start` hook or plugin file. |
|
|
63
|
+
| Change per-turn workflow-state rules | State blocks in `.trellis/workflow.md` and the platform workflow-state hook. |
|
|
64
|
+
| Change how sub-agents read context | Platform agent definitions, the `inject-subagent-context` hook, or agent preludes. |
|
|
65
|
+
| Change JSONL validation/display | `.trellis/scripts/common/task_context.py`. |
|
|
66
|
+
| Change active task resolution | `.trellis/scripts/common/active_task.py`. |
|
|
67
|
+
|
|
68
|
+
When modifying context injection, verify two things: new sessions can see the correct task, and sub-agents can see the correct PRD/spec/research.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Local Files Generated After Init
|
|
2
|
+
|
|
3
|
+
`trellis init` writes the Trellis runtime into the user project. Later, `trellis update` tries to update Trellis-managed template files, but it uses `.trellis/.template-hashes.json` to determine which files have already been modified by the user.
|
|
4
|
+
|
|
5
|
+
This page only describes files that are visible and editable inside the user project.
|
|
6
|
+
|
|
7
|
+
## `.trellis/`
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
.trellis/
|
|
11
|
+
├── workflow.md
|
|
12
|
+
├── config.yaml
|
|
13
|
+
├── .developer
|
|
14
|
+
├── .version
|
|
15
|
+
├── .template-hashes.json
|
|
16
|
+
├── .runtime/
|
|
17
|
+
├── scripts/
|
|
18
|
+
├── spec/
|
|
19
|
+
├── tasks/
|
|
20
|
+
└── workspace/
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
| Path | Usually editable? | Notes |
|
|
24
|
+
| --- | --- | --- |
|
|
25
|
+
| `.trellis/workflow.md` | Yes | Local workflow documentation and AI routing rules. |
|
|
26
|
+
| `.trellis/config.yaml` | Yes | Project configuration, hooks, packages, journal line limits, and related settings. |
|
|
27
|
+
| `.trellis/spec/` | Yes | Project specs, intended to be updated regularly by users and AI. |
|
|
28
|
+
| `.trellis/tasks/` | Yes | Task material and research artifacts, maintained by the task workflow. |
|
|
29
|
+
| `.trellis/workspace/` | Yes | Session records, usually written by `add_session.py`. |
|
|
30
|
+
| `.trellis/scripts/` | Carefully | Local runtime. It can be customized, but only after understanding the call chain. |
|
|
31
|
+
| `.trellis/.runtime/` | No | Runtime state, usually written automatically by hooks/scripts. |
|
|
32
|
+
| `.trellis/.developer` | Carefully | Current developer identity. |
|
|
33
|
+
| `.trellis/.version` | No | Trellis version record used by update/migration logic. |
|
|
34
|
+
| `.trellis/.template-hashes.json` | No | Template hash record. Do not hand-write business rules here. |
|
|
35
|
+
|
|
36
|
+
## Platform Directories
|
|
37
|
+
|
|
38
|
+
Different platforms generate different directories. Common categories:
|
|
39
|
+
|
|
40
|
+
| Category | Example paths | Purpose |
|
|
41
|
+
| --- | --- | --- |
|
|
42
|
+
| hooks | `.claude/hooks/`, `.codex/hooks/`, `.cursor/hooks/` | Inject session context, workflow-state, and sub-agent context. |
|
|
43
|
+
| settings | `.claude/settings.json`, `.codex/hooks.json`, `.qoder/settings.json` | Tell the platform when to run hooks or plugins. |
|
|
44
|
+
| agents | `.claude/agents/`, `.codex/agents/`, `.kiro/agents/` | Define agents such as `trellis-research`, `trellis-implement`, and `trellis-check`. |
|
|
45
|
+
| skills | `.claude/skills/`, `.agents/skills/`, `.qoder/skills/` | Skills that auto-trigger or can be read by AI. |
|
|
46
|
+
| commands/prompts/workflows | `.cursor/commands/`, `.github/prompts/`, `.windsurf/workflows/` | Explicit user-invoked command or workflow entry points. |
|
|
47
|
+
|
|
48
|
+
When modifying a platform directory, also confirm whether `.trellis/workflow.md` still describes the same flow.
|
|
49
|
+
|
|
50
|
+
## Meaning Of Template Hashes
|
|
51
|
+
|
|
52
|
+
`.trellis/.template-hashes.json` records the content hash from the last time Trellis wrote a template file. `trellis update` uses it to distinguish three cases:
|
|
53
|
+
|
|
54
|
+
| Case | Update behavior |
|
|
55
|
+
| --- | --- |
|
|
56
|
+
| File was not modified by the user | It can be updated automatically. |
|
|
57
|
+
| File was modified by the user | Prompt the user to overwrite, keep, or generate `.new`. |
|
|
58
|
+
| File is no longer a current template | It may be deleted, renamed, or preserved according to migration rules. |
|
|
59
|
+
|
|
60
|
+
When an AI customizes local Trellis files, it does not need to maintain hashes manually. It is normal for Trellis update to recognize the result as "modified by the user."
|
|
61
|
+
|
|
62
|
+
## Local Customization Boundaries
|
|
63
|
+
|
|
64
|
+
Editable by default:
|
|
65
|
+
|
|
66
|
+
- `.trellis/workflow.md`
|
|
67
|
+
- `.trellis/config.yaml`
|
|
68
|
+
- `.trellis/spec/**`
|
|
69
|
+
- `.trellis/scripts/**`
|
|
70
|
+
- Platform hooks, settings, agents, skills, commands, prompts, and workflows
|
|
71
|
+
|
|
72
|
+
Do not edit by default:
|
|
73
|
+
|
|
74
|
+
- Global npm install directory
|
|
75
|
+
- `node_modules/@mindfoldhq/trellis`
|
|
76
|
+
- Trellis GitHub repository source code
|
|
77
|
+
- Concrete state files under `.trellis/.runtime/**`
|
|
78
|
+
- Hash contents inside `.trellis/.template-hashes.json`
|
|
79
|
+
|
|
80
|
+
Switch to the Trellis CLI source-code perspective only when the user explicitly wants to contribute upstream.
|
package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/overview.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Local Trellis Architecture Overview
|
|
2
|
+
|
|
3
|
+
`trellis-meta` is for user projects that have already run `trellis init`. The user's machine usually has only the npm-installed `trellis` command plus the Trellis files generated inside the project; it may not have the Trellis CLI source code.
|
|
4
|
+
|
|
5
|
+
Therefore, when an AI uses this skill, the default customization target is local files inside the user project:
|
|
6
|
+
|
|
7
|
+
- `.trellis/`: workflow, tasks, specs, memory, scripts, and runtime state.
|
|
8
|
+
- Platform directories: `.claude/`, `.codex/`, `.cursor/`, `.opencode/`, `.kiro/`, `.gemini/`, `.qoder/`, `.codebuddy/`, `.github/`, `.factory/`, `.pi/`, `.kilocode/`, `.agent/`, `.windsurf/`, and similar directories.
|
|
9
|
+
- Shared skill layer: `.agents/skills/`.
|
|
10
|
+
|
|
11
|
+
Do not default to guiding the user to fork the Trellis CLI repository. Treat upstream source code as the operating target only when the user explicitly says they want to change Trellis upstream source, publish an npm package, or contribute a PR.
|
|
12
|
+
|
|
13
|
+
## Local System Model
|
|
14
|
+
|
|
15
|
+
Trellis provides three layers inside a user project:
|
|
16
|
+
|
|
17
|
+
1. **Workflow layer**: `.trellis/workflow.md` defines phases, routing, next actions, and prompt blocks.
|
|
18
|
+
2. **Persistence layer**: `.trellis/tasks/`, `.trellis/spec/`, and `.trellis/workspace/` store tasks, specs, and session memory.
|
|
19
|
+
3. **Platform integration layer**: hooks, settings, agents, skills, commands, prompts, and workflows in platform directories connect the Trellis workflow to different AI tools.
|
|
20
|
+
|
|
21
|
+
All three layers live inside the user project, so an AI can read and modify them directly.
|
|
22
|
+
|
|
23
|
+
## Core Paths
|
|
24
|
+
|
|
25
|
+
| Path | Purpose |
|
|
26
|
+
| --- | --- |
|
|
27
|
+
| `.trellis/workflow.md` | Workflow phases, skill routing, and workflow-state prompt blocks. |
|
|
28
|
+
| `.trellis/config.yaml` | Project configuration, task lifecycle hooks, monorepo package configuration, and journal configuration. |
|
|
29
|
+
| `.trellis/spec/` | The user's project-specific coding conventions and thinking guides. |
|
|
30
|
+
| `.trellis/tasks/` | Each task's PRD, technical notes, research files, and JSONL context. |
|
|
31
|
+
| `.trellis/workspace/` | Per-developer journals and cross-session memory. |
|
|
32
|
+
| `.trellis/scripts/` | Local Python runtime used by commands, hooks, and context injection. |
|
|
33
|
+
| `.trellis/.runtime/` | Session-level runtime state, such as the current task pointer. |
|
|
34
|
+
| `.trellis/.template-hashes.json` | Template hashes for Trellis-managed files, used by update to determine whether local files were modified by the user. |
|
|
35
|
+
|
|
36
|
+
## AI Customization Principles
|
|
37
|
+
|
|
38
|
+
1. **Find the local source of truth first**: Do not edit from memory. Read `.trellis/workflow.md`, `.trellis/config.yaml`, the relevant platform directory, and related task files first.
|
|
39
|
+
2. **Edit the user project, not the npm package cache**: Modify generated files inside the project, not `node_modules` or the global npm install directory.
|
|
40
|
+
3. **Keep platform files aligned with `.trellis/`**: If workflow routing changes, also check whether platform skills or commands still describe the same flow.
|
|
41
|
+
4. **Put project-specific rules in `.trellis/spec/` or a local skill**: Do not put team conventions into `trellis-meta`.
|
|
42
|
+
5. **Preserve user changes**: If a file was already modified locally, work from the current content instead of overwriting it with a default template.
|
|
43
|
+
|
|
44
|
+
## How To Use This Directory
|
|
45
|
+
|
|
46
|
+
- To understand which files exist after init, read `generated-files.md`.
|
|
47
|
+
- To change phases, routing, or next actions, read `workflow.md`.
|
|
48
|
+
- To change the task model, JSONL context, or active task behavior, read `task-system.md`.
|
|
49
|
+
- To change coding convention injection, read `spec-system.md`.
|
|
50
|
+
- To understand journals and cross-session memory, read `workspace-memory.md`.
|
|
51
|
+
- To change hooks or sub-agent context loading, read `context-injection.md`.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Local Spec System
|
|
2
|
+
|
|
3
|
+
`.trellis/spec/` is the user's project-specific engineering spec library. Trellis is not about making AI memorize conventions; it injects relevant specs or requires the AI to read them at the right time.
|
|
4
|
+
|
|
5
|
+
## Directory Model
|
|
6
|
+
|
|
7
|
+
A common single-repository structure:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
.trellis/spec/
|
|
11
|
+
├── backend/
|
|
12
|
+
│ ├── index.md
|
|
13
|
+
│ └── ...
|
|
14
|
+
├── frontend/
|
|
15
|
+
│ ├── index.md
|
|
16
|
+
│ └── ...
|
|
17
|
+
└── guides/
|
|
18
|
+
├── index.md
|
|
19
|
+
└── ...
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
A common monorepo structure:
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
.trellis/spec/
|
|
26
|
+
├── cli/
|
|
27
|
+
│ ├── backend/
|
|
28
|
+
│ │ ├── index.md
|
|
29
|
+
│ │ └── ...
|
|
30
|
+
│ └── unit-test/
|
|
31
|
+
│ ├── index.md
|
|
32
|
+
│ └── ...
|
|
33
|
+
├── docs-site/
|
|
34
|
+
│ └── docs/
|
|
35
|
+
│ ├── index.md
|
|
36
|
+
│ └── ...
|
|
37
|
+
└── guides/
|
|
38
|
+
├── index.md
|
|
39
|
+
└── ...
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`index.md` is the entry point for each layer. It should list the Pre-Development Checklist and Quality Check. Specific guidelines live in other Markdown files in the same directory.
|
|
43
|
+
|
|
44
|
+
## Package Configuration
|
|
45
|
+
|
|
46
|
+
`.trellis/config.yaml` can declare packages:
|
|
47
|
+
|
|
48
|
+
```yaml
|
|
49
|
+
packages:
|
|
50
|
+
cli:
|
|
51
|
+
path: packages/cli
|
|
52
|
+
docs-site:
|
|
53
|
+
path: docs-site
|
|
54
|
+
type: submodule
|
|
55
|
+
default_package: cli
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The AI can run:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
python3 ./.trellis/scripts/get_context.py --mode packages
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
This command lists packages and spec layers for the current project. Use this output as the reference when configuring context JSONL.
|
|
65
|
+
|
|
66
|
+
## How Specs Enter Tasks
|
|
67
|
+
|
|
68
|
+
Before a task enters implementation, Phase 1.3 should write relevant specs into `implement.jsonl` / `check.jsonl`:
|
|
69
|
+
|
|
70
|
+
```jsonl
|
|
71
|
+
{"file": ".trellis/spec/cli/backend/index.md", "reason": "CLI backend conventions"}
|
|
72
|
+
{"file": ".trellis/spec/cli/unit-test/conventions.md", "reason": "Test expectations"}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Sub-agents or platform preludes read these JSONL files and load the referenced specs. On platforms without sub-agent support, the AI should read the relevant specs directly according to the workflow.
|
|
76
|
+
|
|
77
|
+
## What Specs Should Contain
|
|
78
|
+
|
|
79
|
+
Specs should contain executable engineering conventions for the project, not generic best practices:
|
|
80
|
+
|
|
81
|
+
- Where files should live.
|
|
82
|
+
- How error handling should be expressed.
|
|
83
|
+
- Input/output contracts for APIs, hooks, and commands.
|
|
84
|
+
- Patterns that are forbidden.
|
|
85
|
+
- Cases that require tests.
|
|
86
|
+
- Project-specific pitfalls and how to avoid them.
|
|
87
|
+
|
|
88
|
+
When the AI learns a new rule during implementation or debugging, it should update `.trellis/spec/` rather than only summarizing it in chat.
|
|
89
|
+
|
|
90
|
+
## Local Customization Points
|
|
91
|
+
|
|
92
|
+
| Need | Edit location |
|
|
93
|
+
| --- | --- |
|
|
94
|
+
| Add a new spec layer | `.trellis/spec/<package>/<layer>/index.md` and corresponding guideline files. |
|
|
95
|
+
| Change monorepo spec mapping | `packages` / `default_package` / `spec_scope` in `.trellis/config.yaml`. |
|
|
96
|
+
| Change which specs AI reads before implementation | The task's `implement.jsonl`. |
|
|
97
|
+
| Change which specs AI reads during checking | The task's `check.jsonl`. |
|
|
98
|
+
| Change when specs should be updated | Phase 3.3 in `.trellis/workflow.md` and the `trellis-update-spec` skill. |
|
|
99
|
+
|
|
100
|
+
## Boundaries
|
|
101
|
+
|
|
102
|
+
`.trellis/spec/` is the user's project specification, not a permanent copy of Trellis built-in templates. The AI should encourage the user to update it according to the actual project code instead of treating Trellis default templates as immutable documents.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Local Task System
|
|
2
|
+
|
|
3
|
+
The Trellis task system is stored entirely under `.trellis/tasks/` in the user project. Each task is a directory containing requirements, context, research, state, and relationship information.
|
|
4
|
+
|
|
5
|
+
## Task Directory Structure
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
.trellis/tasks/
|
|
9
|
+
├── 04-28-example-task/
|
|
10
|
+
│ ├── task.json
|
|
11
|
+
│ ├── prd.md
|
|
12
|
+
│ ├── info.md
|
|
13
|
+
│ ├── implement.jsonl
|
|
14
|
+
│ ├── check.jsonl
|
|
15
|
+
│ └── research/
|
|
16
|
+
└── archive/
|
|
17
|
+
└── 2026-04/
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
| File | Purpose |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| `task.json` | Task metadata: status, assignee, priority, branch, parent/child tasks, and similar fields. |
|
|
23
|
+
| `prd.md` | Requirements document; the most important business context during implementation. |
|
|
24
|
+
| `info.md` | Optional technical design. |
|
|
25
|
+
| `implement.jsonl` | List of spec/research files the implement agent must read first. |
|
|
26
|
+
| `check.jsonl` | List of spec/research files the check agent must read first. |
|
|
27
|
+
| `research/` | Research artifacts. Complex findings should not live only in chat. |
|
|
28
|
+
|
|
29
|
+
## `task.json`
|
|
30
|
+
|
|
31
|
+
`task.json` records task status and metadata. Common fields:
|
|
32
|
+
|
|
33
|
+
| Field | Meaning |
|
|
34
|
+
| --- | --- |
|
|
35
|
+
| `id` / `name` / `title` | Task identity and title. |
|
|
36
|
+
| `status` | Status such as `planning`, `in_progress`, `review`, or `completed`. |
|
|
37
|
+
| `priority` | `P0`, `P1`, `P2`, `P3`. |
|
|
38
|
+
| `creator` / `assignee` | Creator and assignee. |
|
|
39
|
+
| `package` | Target package in a monorepo; may be empty. |
|
|
40
|
+
| `branch` / `base_branch` | Working branch and PR target branch. |
|
|
41
|
+
| `children` / `parent` | Parent/child task relationships. |
|
|
42
|
+
| `commit` / `pr_url` | Commit and PR information after completion. |
|
|
43
|
+
| `meta` | Extension fields. |
|
|
44
|
+
|
|
45
|
+
The AI should not treat phase numbers as task status. Task progress is mainly determined by `status`, `prd.md`, whether JSONL context is configured, and the phase descriptions in `workflow.md`.
|
|
46
|
+
|
|
47
|
+
## Active Task
|
|
48
|
+
|
|
49
|
+
The user sees a "current task," but Trellis stores active task state per session.
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
.trellis/.runtime/sessions/<context-key>.json
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`task.py start` writes the task path into the runtime session file for the current session. `task.py current --source` shows the current task and where it came from. Different AI windows can point to different tasks without overwriting each other.
|
|
56
|
+
|
|
57
|
+
If the platform or shell environment has no stable session identity, `task.py start` may be unable to set the active task. The AI should read the error, inspect the platform hook/session environment, and not fall back to a shared global pointer.
|
|
58
|
+
|
|
59
|
+
## JSONL Context
|
|
60
|
+
|
|
61
|
+
`implement.jsonl` and `check.jsonl` are context manifests for sub-agents to read first.
|
|
62
|
+
|
|
63
|
+
Format:
|
|
64
|
+
|
|
65
|
+
```jsonl
|
|
66
|
+
{"file": ".trellis/spec/cli/backend/index.md", "reason": "Backend conventions"}
|
|
67
|
+
{"file": ".trellis/tasks/04-28-example/research/api.md", "reason": "API research"}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Rules:
|
|
71
|
+
|
|
72
|
+
- Include spec and research files.
|
|
73
|
+
- Do not include code files that are about to be modified.
|
|
74
|
+
- Do not treat temporary conclusions in chat as the only context.
|
|
75
|
+
- Seed rows have no `file` field; they only prompt the AI to fill in real entries.
|
|
76
|
+
|
|
77
|
+
## Common Commands
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
python3 ./.trellis/scripts/task.py create "<title>" --slug <slug>
|
|
81
|
+
python3 ./.trellis/scripts/task.py start <task>
|
|
82
|
+
python3 ./.trellis/scripts/task.py current --source
|
|
83
|
+
python3 ./.trellis/scripts/task.py add-context <task> implement <file> <reason>
|
|
84
|
+
python3 ./.trellis/scripts/task.py validate <task>
|
|
85
|
+
python3 ./.trellis/scripts/task.py finish
|
|
86
|
+
python3 ./.trellis/scripts/task.py archive <task>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
When modifying the task system, the AI should prefer script commands to maintain structure. Edit JSON/Markdown directly only when scripts do not cover the need.
|
|
90
|
+
|
|
91
|
+
## Local Customization Points
|
|
92
|
+
|
|
93
|
+
| Need | Edit location |
|
|
94
|
+
| --- | --- |
|
|
95
|
+
| Change the default task template | `.trellis/scripts/common/task_store.py` and task creation instructions. |
|
|
96
|
+
| Change status semantics | `.trellis/workflow.md`, workflow-state hook logic, and task usage conventions. |
|
|
97
|
+
| Add task lifecycle actions | `hooks.after_*` in `.trellis/config.yaml`. |
|
|
98
|
+
| Change context rules | Phase 1.3 in `.trellis/workflow.md` and related platform agent/hook instructions. |
|
|
99
|
+
| Change archive policy | `.trellis/scripts/common/task_store.py` / `task_utils.py`. |
|
|
100
|
+
|
|
101
|
+
These are local files in the user project. Do not default to editing Trellis CLI source code unless the user wants to contribute upstream.
|
package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workflow.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Local Workflow System
|
|
2
|
+
|
|
3
|
+
`.trellis/workflow.md` is the Trellis workflow source of truth inside the user project. An AI does not need Trellis source code to understand how the current project should move tasks forward; this file is enough.
|
|
4
|
+
|
|
5
|
+
## File Responsibilities
|
|
6
|
+
|
|
7
|
+
`.trellis/workflow.md` has three responsibilities:
|
|
8
|
+
|
|
9
|
+
1. **Explain workflow phases**: Plan, Execute, Finish.
|
|
10
|
+
2. **Define skill routing**: which skill or agent the AI should use when the user expresses a certain intent.
|
|
11
|
+
3. **Provide workflow-state prompt blocks**: hooks can inject the prompt block for the current state into the conversation.
|
|
12
|
+
|
|
13
|
+
## Current Phase Model
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
Phase 1: Plan -> clarify what to build, produce prd.md and required research
|
|
17
|
+
Phase 2: Execute -> implement against the PRD and specs, then check
|
|
18
|
+
Phase 3: Finish -> final verification, preserve lessons, and wrap up
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Each phase contains numbered steps, such as `1.3 Configure context`. These numbers are not runtime fields in `task.json`; they are workflow structure for AI and humans to read.
|
|
22
|
+
|
|
23
|
+
## Skill Routing
|
|
24
|
+
|
|
25
|
+
`workflow.md` separates routing by platform capability:
|
|
26
|
+
|
|
27
|
+
- Platforms with sub-agent support: dispatch `trellis-implement` by default for implementation and `trellis-check` for checking.
|
|
28
|
+
- Platforms without sub-agent support: the main session reads skills such as `trellis-before-dev`, then executes directly.
|
|
29
|
+
|
|
30
|
+
When changing local AI behavior, update the routing descriptions in `workflow.md` first, then check whether the corresponding platform skill, command, or agent files need to stay in sync.
|
|
31
|
+
|
|
32
|
+
## Workflow-State Prompt Blocks
|
|
33
|
+
|
|
34
|
+
The bottom of `workflow.md` can contain state blocks like this:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
[workflow-state:no_task]
|
|
38
|
+
...
|
|
39
|
+
[/workflow-state:no_task]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Hooks choose the right block based on current task status and inject it into the conversation. Common states include:
|
|
43
|
+
|
|
44
|
+
| State | Meaning |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| `no_task` | The current session has no active task. |
|
|
47
|
+
| `planning` | The task is still in requirements, research, or context configuration. |
|
|
48
|
+
| `in_progress` | The task has entered implementation and checking. |
|
|
49
|
+
| `completed` | The task is complete and waiting for wrap-up or archive. |
|
|
50
|
+
|
|
51
|
+
If the user wants to change policies such as "whether to create a task when there is no task," "when task creation may be skipped," or "whether sub-agents are required," edit these state blocks and the routing table above them.
|
|
52
|
+
|
|
53
|
+
## Local Modification Patterns
|
|
54
|
+
|
|
55
|
+
Common changes:
|
|
56
|
+
|
|
57
|
+
| Goal | Edit point |
|
|
58
|
+
| --- | --- |
|
|
59
|
+
| Add a phase | Update the Phase Index, phase body, routing, and state blocks. |
|
|
60
|
+
| Change task creation policy | Update the `no_task` state block and Phase 1 description. |
|
|
61
|
+
| Change the default implementation/check path | Update Phase 2 and skill routing. |
|
|
62
|
+
| Change the wrap-up flow | Update Phase 3 and `finish-work` related descriptions. |
|
|
63
|
+
| Change platform differences | Update routing descriptions grouped by platform. |
|
|
64
|
+
|
|
65
|
+
After editing, make the AI reread `.trellis/workflow.md`; do not assume the flow from the old conversation is still valid.
|
|
66
|
+
|
|
67
|
+
## Relationship To Platform Files
|
|
68
|
+
|
|
69
|
+
`workflow.md` is the semantic center of the local workflow, but each platform can also have its own entry files:
|
|
70
|
+
|
|
71
|
+
- skills, such as `trellis-brainstorm` and `trellis-check`.
|
|
72
|
+
- commands/prompts/workflows, such as continue and finish-work.
|
|
73
|
+
- hooks, such as session-start or workflow-state injection.
|
|
74
|
+
|
|
75
|
+
If only `workflow.md` changes, platform entry files may still contain old language. When the user wants to change "what the AI actually does," also inspect the relevant platform directory.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Local Workspace Memory System
|
|
2
|
+
|
|
3
|
+
`.trellis/workspace/` stores cross-session memory. Its purpose is to let AI and humans understand what happened before across different windows and different days.
|
|
4
|
+
|
|
5
|
+
## Directory Structure
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
.trellis/workspace/
|
|
9
|
+
├── index.md
|
|
10
|
+
└── <developer>/
|
|
11
|
+
├── index.md
|
|
12
|
+
├── journal-1.md
|
|
13
|
+
└── journal-2.md
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
| File | Purpose |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| `.trellis/.developer` | Current developer identity. |
|
|
19
|
+
| `.trellis/workspace/index.md` | Global workspace overview. |
|
|
20
|
+
| `.trellis/workspace/<developer>/index.md` | Session index for a developer. |
|
|
21
|
+
| `.trellis/workspace/<developer>/journal-N.md` | Session journal. |
|
|
22
|
+
|
|
23
|
+
## Developer Identity
|
|
24
|
+
|
|
25
|
+
Run this the first time:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
python3 ./.trellis/scripts/init_developer.py <name>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This creates `.trellis/.developer` and the corresponding workspace directory. The AI should not change developer identity casually; if the identity is wrong, first confirm who is using the current project.
|
|
32
|
+
|
|
33
|
+
## Journal
|
|
34
|
+
|
|
35
|
+
`journal-N.md` records completed or partially completed work from each session. By default, each journal holds about 2000 lines; after that it rotates to the next file.
|
|
36
|
+
|
|
37
|
+
Common command for recording a session:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
python3 ./.trellis/scripts/add_session.py \
|
|
41
|
+
--title "Session title" \
|
|
42
|
+
--summary "What changed" \
|
|
43
|
+
--commit "abc1234"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Planning or review work without a commit can also be recorded by using `--no-commit` or an empty commit value.
|
|
47
|
+
|
|
48
|
+
## Relationship Between Workspace Memory And Tasks
|
|
49
|
+
|
|
50
|
+
| System | What it stores |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| `.trellis/tasks/` | Requirements, design, research, and state for a specific task. |
|
|
53
|
+
| `.trellis/workspace/` | Work records across tasks and sessions. |
|
|
54
|
+
| `.trellis/spec/` | Engineering knowledge preserved as long-term conventions. |
|
|
55
|
+
|
|
56
|
+
If information is only useful for the current task, put it in the task directory.
|
|
57
|
+
If information describes what happened in the current session, put it in the workspace journal.
|
|
58
|
+
If information should be followed every time code is written in the future, put it in spec.
|
|
59
|
+
|
|
60
|
+
## Local Customization Points
|
|
61
|
+
|
|
62
|
+
| Need | Edit location |
|
|
63
|
+
| --- | --- |
|
|
64
|
+
| Change maximum journal lines | `max_journal_lines` in `.trellis/config.yaml`. |
|
|
65
|
+
| Change session auto-commit message | `session_commit_message` in `.trellis/config.yaml`. |
|
|
66
|
+
| Change session content format | `.trellis/scripts/add_session.py`. |
|
|
67
|
+
| Change how workspace is displayed in context | `.trellis/scripts/common/session_context.py`. |
|
|
68
|
+
|
|
69
|
+
## AI Usage Rules
|
|
70
|
+
|
|
71
|
+
The AI should not treat workspace as the only source of truth. When resuming a task, read the current task first, then use workspace for background. After a task is complete, record important process notes in workspace; if long-term rules emerged, update spec.
|