donna 0.2.0__py3-none-any.whl → 0.2.2__py3-none-any.whl
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.
- donna/artifacts/intro.md +39 -0
- donna/artifacts/research/specs/report.md +163 -0
- donna/artifacts/research/work/research.md +198 -0
- donna/artifacts/rfc/specs/request_for_change.md +270 -0
- donna/artifacts/rfc/work/create.md +120 -0
- donna/artifacts/rfc/work/do.md +109 -0
- donna/artifacts/rfc/work/plan.md +68 -0
- donna/artifacts/usage/artifacts.md +55 -12
- donna/artifacts/usage/cli.md +114 -39
- donna/artifacts/usage/worlds.md +8 -2
- donna/cli/__main__.py +1 -1
- donna/cli/commands/artifacts.py +104 -17
- donna/cli/commands/sessions.py +8 -8
- donna/cli/commands/workspaces.py +42 -0
- donna/cli/errors.py +18 -0
- donna/cli/types.py +16 -9
- donna/cli/utils.py +2 -2
- donna/core/errors.py +1 -11
- donna/core/result.py +5 -8
- donna/core/utils.py +0 -3
- donna/lib/__init__.py +4 -0
- donna/lib/sources.py +1 -1
- donna/lib/worlds.py +2 -2
- donna/machine/action_requests.py +0 -5
- donna/machine/artifacts.py +8 -6
- donna/machine/primitives.py +5 -5
- donna/machine/sessions.py +13 -5
- donna/machine/state.py +4 -4
- donna/machine/tasks.py +4 -18
- donna/machine/templates.py +4 -2
- donna/primitives/artifacts/specification.py +13 -2
- donna/primitives/artifacts/workflow.py +11 -2
- donna/primitives/directives/list.py +86 -0
- donna/primitives/directives/view.py +52 -11
- donna/primitives/operations/finish_workflow.py +13 -2
- donna/primitives/operations/output.py +87 -0
- donna/primitives/operations/request_action.py +3 -9
- donna/primitives/operations/run_script.py +2 -2
- donna/protocol/utils.py +22 -0
- donna/workspaces/artifacts.py +238 -0
- donna/{world → workspaces}/artifacts_discovery.py +1 -1
- donna/{world → workspaces}/config.py +18 -11
- donna/{world → workspaces}/errors.py +55 -45
- donna/workspaces/initialization.py +78 -0
- donna/{world → workspaces}/markdown.py +21 -26
- donna/{world → workspaces}/sources/base.py +2 -2
- donna/{world → workspaces}/sources/markdown.py +8 -7
- donna/{world → workspaces}/templates.py +4 -4
- donna/workspaces/tmp.py +51 -0
- donna/{world → workspaces}/worlds/base.py +6 -3
- donna/{world → workspaces}/worlds/filesystem.py +30 -10
- donna/{world → workspaces}/worlds/python.py +12 -9
- donna-0.2.2.dist-info/METADATA +463 -0
- donna-0.2.2.dist-info/RECORD +92 -0
- {donna-0.2.0.dist-info → donna-0.2.2.dist-info}/WHEEL +1 -1
- donna/artifacts/work/do_it.md +0 -142
- donna/artifacts/work/do_it_fast.md +0 -98
- donna/artifacts/work/planning.md +0 -245
- donna/cli/commands/projects.py +0 -49
- donna/world/artifacts.py +0 -122
- donna/world/initialization.py +0 -42
- donna/world/tmp.py +0 -33
- donna/world/worlds/__init__.py +0 -0
- donna-0.2.0.dist-info/METADATA +0 -44
- donna-0.2.0.dist-info/RECORD +0 -85
- /donna/{artifacts/work → workspaces}/__init__.py +0 -0
- /donna/{world → workspaces}/sources/__init__.py +0 -0
- /donna/{world → workspaces/worlds}/__init__.py +0 -0
- {donna-0.2.0.dist-info → donna-0.2.2.dist-info}/entry_points.txt +0 -0
- {donna-0.2.0.dist-info → donna-0.2.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
|
|
2
|
+
# Create a Request for Change
|
|
3
|
+
|
|
4
|
+
```toml donna
|
|
5
|
+
kind = "donna.lib.workflow"
|
|
6
|
+
start_operation_id = "start"
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
This workflow creates a Request for Change (RFC) document based on a description of the problem or the required changes.
|
|
10
|
+
|
|
11
|
+
## Start Work
|
|
12
|
+
|
|
13
|
+
```toml donna
|
|
14
|
+
id = "start"
|
|
15
|
+
kind = "donna.lib.request_action"
|
|
16
|
+
fsm_mode = "start"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
1. Read the specification `{{ donna.lib.view("donna:rfc:specs:request_for_change") }}` if you haven't done it yet.
|
|
20
|
+
2. Read the specification `{{ donna.lib.view("donna:usage:artifacts") }}` if you haven't done it yet.
|
|
21
|
+
3. `{{ donna.lib.goto("ensure_work_description_exists") }}`
|
|
22
|
+
|
|
23
|
+
## Ensure work description exists
|
|
24
|
+
|
|
25
|
+
```toml donna
|
|
26
|
+
id = "ensure_work_description_exists"
|
|
27
|
+
kind = "donna.lib.request_action"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
At this point, you SHOULD have a clear description of the problem in your context. I.e. you know what you need to do in this workflow.
|
|
31
|
+
|
|
32
|
+
1. If you have a problem description in your context, `{{ donna.lib.goto("prepare_rfc_artifact") }}`.
|
|
33
|
+
2. If you have no problem description in your context, but you know it is in one of `{{ donna.lib.list("session:**") }}` artifacts, find and view it. Then `{{ donna.lib.goto("prepare_rfc_artifact") }}`.
|
|
34
|
+
3. If you have no problem description in your context, and you don't know where it is, ask the developer to provide it. After you get the problem description, `{{ donna.lib.goto("prepare_rfc_artifact") }}`.
|
|
35
|
+
|
|
36
|
+
## Prepare RFC artifact
|
|
37
|
+
|
|
38
|
+
```toml donna
|
|
39
|
+
id = "prepare_rfc_artifact"
|
|
40
|
+
kind = "donna.lib.request_action"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
1. If the name of the artifact is not specified explicitly, assume it to be `session:rfc:<short-problem-related-identifier>`, where `<short-problem-related-identifier>` MUST be unique within the session.
|
|
44
|
+
2. Save the next template into the artifact, replace `<variables>` with appropriate values.
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
# <Title>
|
|
48
|
+
|
|
49
|
+
<short description of the proposed change>
|
|
50
|
+
|
|
51
|
+
## Original description
|
|
52
|
+
|
|
53
|
+
<original description of the requested changes from the developer or parent workflow>
|
|
54
|
+
|
|
55
|
+
## Formal description
|
|
56
|
+
|
|
57
|
+
## Goals
|
|
58
|
+
|
|
59
|
+
## Objectives
|
|
60
|
+
|
|
61
|
+
## Constraints
|
|
62
|
+
|
|
63
|
+
## Requirements
|
|
64
|
+
|
|
65
|
+
## Acceptance criteria
|
|
66
|
+
|
|
67
|
+
## Solution
|
|
68
|
+
|
|
69
|
+
## Verification
|
|
70
|
+
|
|
71
|
+
## Deliverables
|
|
72
|
+
|
|
73
|
+
## Action items
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
3. `{{ donna.lib.goto("initial_fill") }}`
|
|
77
|
+
|
|
78
|
+
## Initial Fill
|
|
79
|
+
|
|
80
|
+
```toml donna
|
|
81
|
+
id = "initial_fill"
|
|
82
|
+
kind = "donna.lib.request_action"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
1. Read the specification `{{ donna.lib.view("donna:rfc:specs:request_for_change") }}` if you haven't done it yet.
|
|
86
|
+
2. Analyze the project if needed to understand the context of the requested change.
|
|
87
|
+
3. Based on the problem description you have, fill in all sections of the RFC draft artifact.
|
|
88
|
+
4. `{{ donna.lib.goto("review_rfc_format") }}`
|
|
89
|
+
|
|
90
|
+
## Review RFC Format
|
|
91
|
+
|
|
92
|
+
```toml donna
|
|
93
|
+
id = "review_rfc_format"
|
|
94
|
+
kind = "donna.lib.request_action"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
1. List mismatches between the RFC artifact and the RFC specification `{{ donna.lib.view("donna:rfc:specs:request_for_change") }}`.
|
|
98
|
+
2. For each mismatch, make necessary edits to the RFC draft artifact to ensure compliance with the RFC specification.
|
|
99
|
+
3. `{{ donna.lib.goto("review_rfc_content") }}`
|
|
100
|
+
|
|
101
|
+
## Review RFC Content
|
|
102
|
+
|
|
103
|
+
```toml donna
|
|
104
|
+
id = "review_rfc_content"
|
|
105
|
+
kind = "donna.lib.request_action"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
1. Read the RFC document and identify any gaps, inconsistencies, or areas for improvement in the content in accordance with the current project context. Use `{{ donna.lib.view("donna:research:work:research") }}` workflow if you need to make a complex decision.
|
|
109
|
+
2. Make necessary edits to the RFC draft artifact to address identified issues.
|
|
110
|
+
3. If there were changes made on this step or the previous `review_rfc_format` step `{{ donna.lib.goto("review_rfc_format") }}`.
|
|
111
|
+
4. If no changes were made, `{{ donna.lib.goto("finish") }}`.
|
|
112
|
+
|
|
113
|
+
## Complete Draft
|
|
114
|
+
|
|
115
|
+
```toml donna
|
|
116
|
+
id = "finish"
|
|
117
|
+
kind = "donna.lib.finish"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
RFC draft is complete and ready for planning or review.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
|
|
2
|
+
# Do Request For Change work
|
|
3
|
+
|
|
4
|
+
```toml donna
|
|
5
|
+
kind = "donna.lib.workflow"
|
|
6
|
+
start_operation_id = "estimate_complexity"
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
This workflow uses a description of a problem or changes required from the developer or parent workflow to:
|
|
10
|
+
|
|
11
|
+
1. Create a Request for Change (RFC) artifact.
|
|
12
|
+
2. Plan the work required to implement the RFC.
|
|
13
|
+
3. Execute the planned work.
|
|
14
|
+
|
|
15
|
+
## Estimate complexity
|
|
16
|
+
|
|
17
|
+
```toml donna
|
|
18
|
+
id = "estimate_complexity"
|
|
19
|
+
kind = "donna.lib.request_action"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
1. If the developer or parent workflow explicitly specified that the work is complex, `{{ donna.lib.goto("create_rfc") }}`.
|
|
23
|
+
2. If the developer or parent workflow explicitly specified that the work is simple, `{{ donna.lib.goto("fast_planning") }}`.
|
|
24
|
+
3. Make a rough estimate of the complexity of the requested changes.
|
|
25
|
+
4. If the complexity is small, `{{ donna.lib.goto("fast_planning") }}`.
|
|
26
|
+
5. Otherwise, `{{ donna.lib.goto("create_rfc") }}`.
|
|
27
|
+
|
|
28
|
+
Examples of changes with small complexity:
|
|
29
|
+
|
|
30
|
+
- A single file edit with clear instructions.
|
|
31
|
+
- A small addition to an existing function or class.
|
|
32
|
+
- A minor configuration change.
|
|
33
|
+
- A small documentation update.
|
|
34
|
+
- A simple bug fix with a known solution.
|
|
35
|
+
|
|
36
|
+
## Fast planning
|
|
37
|
+
|
|
38
|
+
```toml donna
|
|
39
|
+
id = "fast_planning"
|
|
40
|
+
kind = "donna.lib.request_action"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
1. Draft a simple plan to implement the requested changes directly, without creating a formal RFC artifact.
|
|
44
|
+
2. `{{ donna.lib.goto("plan_rfc_work") }}`.
|
|
45
|
+
|
|
46
|
+
## Create RFC
|
|
47
|
+
|
|
48
|
+
```toml donna
|
|
49
|
+
id = "create_rfc"
|
|
50
|
+
kind = "donna.lib.request_action"
|
|
51
|
+
fsm_mode = "start"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
1. Choose a workflow to create an RFC artifact.
|
|
55
|
+
2. Run the chosen workflow.
|
|
56
|
+
2. After completing the workflow `{{ donna.lib.goto("plan_rfc_work") }}`.
|
|
57
|
+
|
|
58
|
+
## Plan RFC work
|
|
59
|
+
|
|
60
|
+
```toml donna
|
|
61
|
+
id = "plan_rfc_work"
|
|
62
|
+
kind = "donna.lib.request_action"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
1. Choose the workflow to plan the work required to implement the RFC created in the previous step.
|
|
66
|
+
2. Run the chosen workflow.
|
|
67
|
+
3. Ensure you know the workflow id created in the previous step (default is `session:execute_rfc` if not specified).
|
|
68
|
+
4. After completing the workflow `{{ donna.lib.goto("execute_rfc_work") }}`.
|
|
69
|
+
|
|
70
|
+
## Execute RFC work
|
|
71
|
+
|
|
72
|
+
```toml donna
|
|
73
|
+
id = "execute_rfc_work"
|
|
74
|
+
kind = "donna.lib.request_action"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
1. Run the workflow created by the plan step (default: `session:execute_rfc`) and complete it.
|
|
78
|
+
2. After completing the workflow `{{ donna.lib.goto("polish_changes") }}`.
|
|
79
|
+
|
|
80
|
+
## Polish changes
|
|
81
|
+
|
|
82
|
+
```toml donna
|
|
83
|
+
id = "polish_changes"
|
|
84
|
+
kind = "donna.lib.request_action"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
1. Find the workflow to polish the changes made.
|
|
88
|
+
2. Run the chosen workflow if you found one.
|
|
89
|
+
3. `{{ donna.lib.goto("log_changes") }}`.
|
|
90
|
+
|
|
91
|
+
## Log changes
|
|
92
|
+
|
|
93
|
+
```toml donna
|
|
94
|
+
id = "log_changes"
|
|
95
|
+
kind = "donna.lib.request_action"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
1. Find the workflow to log the changes made in the scope of this RFC.
|
|
99
|
+
2. Run the chosen workflow if you found one.
|
|
100
|
+
3. `{{ donna.lib.goto("finish") }}`.
|
|
101
|
+
|
|
102
|
+
## Finish
|
|
103
|
+
|
|
104
|
+
```toml donna
|
|
105
|
+
id = "finish"
|
|
106
|
+
kind = "donna.lib.finish"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
RFC workflow execution completed. Report the outcome to the developer.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
|
|
2
|
+
# Plan work on Request For Change
|
|
3
|
+
|
|
4
|
+
```toml donna
|
|
5
|
+
kind = "donna.lib.workflow"
|
|
6
|
+
start_operation_id = "start"
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
This workflow plans the work required to implement a specified Request for Change (RFC). The result of this workflow is a new workflow in the `session:*` world with detailed steps to implement the RFC.
|
|
10
|
+
|
|
11
|
+
## Start Work
|
|
12
|
+
|
|
13
|
+
```toml donna
|
|
14
|
+
id = "start"
|
|
15
|
+
kind = "donna.lib.request_action"
|
|
16
|
+
fsm_mode = "start"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
1. Read the RFC that the developer or parent workflow wants you to implement.
|
|
20
|
+
2. Read the specification `{{ donna.lib.view("donna:usage:artifacts") }}` if you haven't done it yet.
|
|
21
|
+
2. `{{ donna.lib.goto("prepare_workflow_artifact") }}`
|
|
22
|
+
|
|
23
|
+
## Prepare workflow artifact
|
|
24
|
+
|
|
25
|
+
```toml donna
|
|
26
|
+
id = "prepare_workflow_artifact"
|
|
27
|
+
kind = "donna.lib.request_action"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
1. If the name of the artifact is not specified explicitly, assume it to `session:plans:<short-id-equal-to-rfc-slug>`.
|
|
31
|
+
2. Create a workflow with the next operations:
|
|
32
|
+
- Start
|
|
33
|
+
- A step for each action point in the RFC, ordered to minimize dependencies between steps and introduce changes incrementally.
|
|
34
|
+
- (`id="review_changes"`) A gate step to start reviewing the changes.
|
|
35
|
+
- A gate step to start reviewing the deliverables.
|
|
36
|
+
- A step per deliverable to check if it exists and is correct. If the deliverable is missing or incorrect, the step MUST specify how to fix it and `goto` to the `review_changes` step.
|
|
37
|
+
- A gate step to start verification.
|
|
38
|
+
- A step for each verification statement to check it. If the statement is not satisfied, the step MUST specify how to fix it and `goto` to the `review_changes` step.
|
|
39
|
+
- A finish step.
|
|
40
|
+
3. `{{ donna.lib.goto("review_workflow") }}`
|
|
41
|
+
|
|
42
|
+
## Review workflow
|
|
43
|
+
|
|
44
|
+
```toml donna
|
|
45
|
+
id = "review_workflow"
|
|
46
|
+
kind = "donna.lib.request_action"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
For each of the steps in the workflow you created:
|
|
50
|
+
|
|
51
|
+
1. If the step can fail, add instructions on how to fix the issue and `goto` to the appropriate step.
|
|
52
|
+
2. If the step requires both research and implementation, split it into two steps: research step and implementation step.
|
|
53
|
+
3. If the step required editing multiple artifacts (multiple files, multiple functions, etc.), split it into multiple steps, one per change required.
|
|
54
|
+
4. If the step is too big or complex, split it into multiple smaller steps.
|
|
55
|
+
|
|
56
|
+
After all steps are reviewed:
|
|
57
|
+
|
|
58
|
+
1. If the changes were introduced, `{{ donna.lib.goto("review_workflow") }}`.
|
|
59
|
+
2. If no changes were introduced, `{{ donna.lib.goto("finish") }}`.
|
|
60
|
+
|
|
61
|
+
## Finish
|
|
62
|
+
|
|
63
|
+
```toml donna
|
|
64
|
+
id = "finish"
|
|
65
|
+
kind = "donna.lib.finish"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
RFC work plan finalized. Ready to execute the planned workflow.
|
|
@@ -18,6 +18,8 @@ The text artifact has a source and one or more rendered representations, produce
|
|
|
18
18
|
|
|
19
19
|
To change the artifact, developers and agents edit its source.
|
|
20
20
|
|
|
21
|
+
When you need a scratch file for artifact-related work, use `donna -p <protocol> artifacts tmp '<slug>.<extension>'` to create a temporary file in the workspace temp directory.
|
|
22
|
+
|
|
21
23
|
To get information from the artifact, developers, agents and Donna view one of its representations (typically via the view rendering mode).
|
|
22
24
|
|
|
23
25
|
**If you need an information from the artifact, you MUST view its representation**. Artifact sources are only for editing.
|
|
@@ -26,19 +28,29 @@ Read the specification `{{ donna.lib.view("donna:usage:cli") }}` to learn how to
|
|
|
26
28
|
|
|
27
29
|
## Source Format and Rendering
|
|
28
30
|
|
|
29
|
-
The source of the text artifact is a Jinja2
|
|
31
|
+
The source of the text artifact is a Jinja2 template of a Markdown document.
|
|
30
32
|
|
|
31
33
|
When rendering the artifact, Donna processes the Jinja2 template with a predefined context (at minimum `render_mode` and `artifact_id`, and optionally `current_task`/`current_work_unit` during workflow execution), then renders the resulting Markdown content into the desired representation based on the selected rendering mode.
|
|
32
34
|
|
|
33
|
-
**Artifact source should not use Jinja2
|
|
35
|
+
**Artifact source should not use Jinja2 inheritance features** like `{{ "{% extends %}" }}` and `{{ "{% block %}" }}`.
|
|
34
36
|
|
|
35
37
|
Donna provides a set of special directives that can and MUST be used in the artifact source to enhance its behavior. Some of these directives are valid for all artifacts, some are valid only for specific section kinds.
|
|
36
38
|
|
|
37
39
|
Here are some examples:
|
|
38
40
|
|
|
39
|
-
- `{{ "{{ donna.lib.view(<artifact-id>) }}" }}` — references another artifact. In `view`/`execute` modes it renders an exact CLI command to view the artifact; in `analysis` mode it renders a `$$donna ... $$` marker used for internal parsing.
|
|
41
|
+
- `{{ "{{ donna.lib.view(<artifact-id-pattern>) }}" }}` — references another artifact (supports `*` and `**` wildcard patterns). In `view`/`execute` modes it renders an exact CLI command to view the artifact; in `analysis` mode it renders a `$$donna ... $$` marker used for internal parsing.
|
|
42
|
+
- `{{ "{{ donna.lib.list(<artifact-id-pattern>) }}" }}` — references artifact listing by pattern (supports `*` and `**` wildcard patterns). In `view`/`execute` modes it renders an exact CLI command to list artifacts; in `analysis` mode it renders a `$$donna ... $$` marker used for internal parsing.
|
|
40
43
|
- `{{ "{{ donna.lib.goto(<workflow-operation-id>) }}" }}` — references the next workflow operation to execute. In `view`/`execute` modes it renders an exact CLI command to advance the workflow; in `analysis` mode it renders a `$$donna goto ... $$` marker used to extract workflow transitions.
|
|
41
44
|
|
|
45
|
+
## Jinja2 rendering
|
|
46
|
+
|
|
47
|
+
Donna allows all of Jinja2 expressions in artifact sources, except inheritance-related once: `{{ "{% extends %}" }}` , `{{ "{% block %}" }}`, etc.
|
|
48
|
+
|
|
49
|
+
Donna intentionally hides some parts of the source in the rendered output, but they remain visible in source views (for example, in `artifacts fetch` output or on GitHub):
|
|
50
|
+
|
|
51
|
+
- fenced code blocks with the `donna` marker (they contain technical information for the Donna, not information for the agent).
|
|
52
|
+
- Jinja2 comments like `{{ "{# ... #}" }}`.
|
|
53
|
+
|
|
42
54
|
## Rendering artifacts
|
|
43
55
|
|
|
44
56
|
Donna renders the same artifact source into different representations depending on the rendering mode. The mode is internal to Donna (users do not select it directly) and controls how directives are expanded and which metadata is included.
|
|
@@ -51,11 +63,11 @@ Donna renders the same artifact source into different representations depending
|
|
|
51
63
|
|
|
52
64
|
Technically, any valid Markdown document is a valid text artifact.
|
|
53
65
|
|
|
54
|
-
However, Donna
|
|
66
|
+
However, Donna assigns special meaning to some elements of the Markdown document to provide enhanced behavior and capabilities.
|
|
55
67
|
|
|
56
68
|
### Sections
|
|
57
69
|
|
|
58
|
-
Artifact is
|
|
70
|
+
Artifact is divided into multiple sections:
|
|
59
71
|
|
|
60
72
|
- H1 header and all text till the first H2 header is considered the `head section` of the artifact.
|
|
61
73
|
- Each H2 header and all text till the next H2 header (or end of document) is considered a `tail section` of the artifact.
|
|
@@ -88,7 +100,7 @@ The configuration block properties format is `property1 property2=value2 propert
|
|
|
88
100
|
|
|
89
101
|
The content of the block is parsed according to the primary format and interpreted according its properties.
|
|
90
102
|
|
|
91
|
-
Configuration blocks are parsed by Donna and removed from rendered Markdown representations; they remain in the source for editing and inspection (e.g., via `artifacts fetch` or the repository file).
|
|
103
|
+
Configuration blocks are parsed by Donna and removed from rendered Markdown representations (see "Jinja2 rendering"); they remain in the source for editing and inspection (e.g., via `artifacts fetch` or the repository file).
|
|
92
104
|
|
|
93
105
|
Fences without `donna` keyword are considered regular code blocks and have no special meaning for Donna.
|
|
94
106
|
|
|
@@ -101,6 +113,14 @@ When a section contains multiple configuration blocks, Donna merges them in docu
|
|
|
101
113
|
- The merge is shallow: if a key maps to a nested object, a later block replaces the whole value (there is no deep merge).
|
|
102
114
|
- Config blocks in subsections (H3 and below) belong to their parent H2 tail section and are merged into that section's configuration.
|
|
103
115
|
|
|
116
|
+
### Artifact Tags
|
|
117
|
+
|
|
118
|
+
Artifacts can include semantic tags via a `tags` field in the section configuration. Tags are a list of strings and default to an empty list `[]` when omitted.
|
|
119
|
+
|
|
120
|
+
Tags are used for deterministic artifact filtering and discovery (for example, via `donna -p <protocol> artifacts list ... --tag <tag>`). Tags are typically attached to the primary section and describe the artifact as a whole.
|
|
121
|
+
|
|
122
|
+
The canonical list of standard tags is documented in `donna:intro`.
|
|
123
|
+
|
|
104
124
|
## Section Kinds, Their Formats and Behaviors
|
|
105
125
|
|
|
106
126
|
### Header section
|
|
@@ -150,7 +170,9 @@ kind = "donna.lib.request_action"
|
|
|
150
170
|
|
|
151
171
|
#### Kinds of Workflow Operations
|
|
152
172
|
|
|
153
|
-
|
|
173
|
+
##### `donna.lib.request_action`
|
|
174
|
+
|
|
175
|
+
`donna.lib.request_action` operation kind indicates that Donna will request the agent to perform some action.
|
|
154
176
|
|
|
155
177
|
The content of the tail section is the text instructions for the agent on what to do.
|
|
156
178
|
|
|
@@ -168,7 +190,9 @@ Here may be any additional instructions, requirements, notes, references, etc.
|
|
|
168
190
|
|
|
169
191
|
**The body of the operation MUST contain a neat strictly defined algorithm for the agent to follow.**
|
|
170
192
|
|
|
171
|
-
|
|
193
|
+
##### `donna.lib.run_script`
|
|
194
|
+
|
|
195
|
+
`donna.lib.run_script` operation kind executes a script from the operation body without agent/user interaction.
|
|
172
196
|
|
|
173
197
|
The body of the operation MUST include exactly one fenced code block whose info string includes `<language> donna script`.
|
|
174
198
|
Any other text in the operation body is ignored.
|
|
@@ -209,7 +233,25 @@ Routing rules:
|
|
|
209
233
|
When `save_stdout_to` and/or `save_stderr_to` are set, the operation stores captured output in the task context
|
|
210
234
|
under the specified variable names.
|
|
211
235
|
|
|
212
|
-
|
|
236
|
+
##### `donna.lib.output`
|
|
237
|
+
|
|
238
|
+
`donna.lib.output` operation kind emits its body as an output cell and then continues to the configured next step.
|
|
239
|
+
|
|
240
|
+
The body of the operation is rendered as an output cell during execution.
|
|
241
|
+
|
|
242
|
+
Configuration options:
|
|
243
|
+
|
|
244
|
+
```toml
|
|
245
|
+
id = "<operation_id>"
|
|
246
|
+
kind = "donna.lib.output"
|
|
247
|
+
next_operation_id = "<next_operation_id>" # required
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
##### `donna.lib.finish`
|
|
251
|
+
|
|
252
|
+
`donna.lib.finish` operation kind indicates that the workflow is finished.
|
|
253
|
+
|
|
254
|
+
The body of the operation is rendered as an output cell before the workflow completes.
|
|
213
255
|
|
|
214
256
|
Each possible path through the workflow MUST end with this operation kind.
|
|
215
257
|
|
|
@@ -219,6 +261,7 @@ Donna provides multiple directives that MUST be used in the artifact source to e
|
|
|
219
261
|
|
|
220
262
|
Here they are:
|
|
221
263
|
|
|
222
|
-
1. `{{ "{{ donna.lib.view(<
|
|
223
|
-
2. `{{ "{{ donna.lib.
|
|
224
|
-
3. `{{ "{{ donna.lib.
|
|
264
|
+
1. `{{ "{{ donna.lib.view(<artifact-id-pattern>) }}" }}` — references another artifact (supports `*` and `**` wildcard patterns). In `view`/`execute` modes it renders an exact CLI command to view the artifact; in `analysis` mode it renders a `$$donna ... $$` marker.
|
|
265
|
+
2. `{{ "{{ donna.lib.list(<artifact-id-pattern>) }}" }}` — references artifact listing by pattern (supports `*` and `**` wildcard patterns). In `view`/`execute` modes it renders an exact CLI command to list artifacts; in `analysis` mode, it renders a `$$donna ... $$` marker.
|
|
266
|
+
3. `{{ "{{ donna.lib.goto(<workflow-operation-id>) }}" }}` — references the next workflow operation to execute. In `view`/`execute` modes it renders an exact CLI command to advance the workflow; in `analysis` mode, it renders a `$$donna goto ... $$` marker used for transition extraction.
|
|
267
|
+
4. `{{ "{{ donna.lib.task_variable(<variable_name>) }}" }}` — in `view` mode renders a placeholder note about task-variable substitution, in `execute` mode renders the actual task-context value (or an explicit error marker if missing), and in `analysis` mode renders a `$$donna task_variable ... $$` marker.
|
donna/artifacts/usage/cli.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
kind = "donna.lib.specification"
|
|
5
5
|
```
|
|
6
6
|
|
|
7
|
-
This document describes how agents MUST use Donna to manage and perform their workflows.
|
|
7
|
+
This document describes how agents MUST use Donna CLI to manage and perform their workflows.
|
|
8
8
|
|
|
9
9
|
**Agents MUST follow the instructions and guidelines outlined in this document precisely.**
|
|
10
10
|
|
|
@@ -12,66 +12,141 @@ This document describes how agents MUST use Donna to manage and perform their wo
|
|
|
12
12
|
|
|
13
13
|
`donna` is a CLI tool that helps manage the work of AI agents like OpenAI Codex.
|
|
14
14
|
|
|
15
|
-
It is designed to invert control flow: instead of agents deciding what to do next, the
|
|
15
|
+
It is designed to invert control flow: instead of agents deciding what to do next, the Donna tells agents what to do. The tool achieves this by following predefined workflows that describe how to perform various tasks. One may look at workflows as hierarchical state machines (HSM) that guide agents through complex processes step by step.
|
|
16
16
|
|
|
17
|
-
The core idea is that most high-level workflows are more algorithmic than it may seem at first glance. For example, it may be difficult to fix a particular
|
|
17
|
+
The core idea is that most high-level workflows are more algorithmic than it may seem at first glance. For example, it may be difficult to fix a particular problem in the codebase, but the overall process of polishing it is quite linear:
|
|
18
18
|
|
|
19
|
-
1.
|
|
20
|
-
2.
|
|
21
|
-
3.
|
|
19
|
+
1. Run tests, if they fail, fix the problems.
|
|
20
|
+
2. Format the code.
|
|
21
|
+
3. Run linters, if there are issues, fix them.
|
|
22
22
|
4. Go to the step 1 if you changed something in the process.
|
|
23
23
|
5. Finish.
|
|
24
24
|
|
|
25
|
-
We may need coding agents on the each step of the process, but there no reason for agents to manage the whole loop by themselves — it takes longer time, spends tokens and confuses agents.
|
|
25
|
+
We may need coding agents on the each step of the process, but there no reason for agents to manage the whole loop by themselves — it takes longer time, spends tokens and confuses agents because they need to reason over long contexts.
|
|
26
26
|
|
|
27
|
-
## Primary
|
|
27
|
+
## Primary rules for agents
|
|
28
28
|
|
|
29
|
+
- Donna stores all project-related data in `.donna` directory in the project root.
|
|
29
30
|
- All work is always done in the context of a session. There is only one active session at a time.
|
|
30
31
|
- You MUST always work on one task assigned to you.
|
|
31
|
-
-
|
|
32
|
-
-
|
|
32
|
+
- You MUST keep all the information about the session in your memory.
|
|
33
|
+
- You always can ask the `donna` tool for the session details if you forget something.
|
|
33
34
|
|
|
34
|
-
##
|
|
35
|
+
## CLI
|
|
36
|
+
|
|
37
|
+
### Protocol
|
|
35
38
|
|
|
36
39
|
Protocol selects the output formatting and behavior of Donna's CLI for different consumers (humans, LLMs, automation).
|
|
37
|
-
When an agent invokes Donna, it SHOULD use the `llm` protocol (`-p llm`) unless the
|
|
38
|
-
|
|
39
|
-
###
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
When an agent invokes Donna, it SHOULD use the `llm` protocol (pass an `-p llm` argument) unless the developer explicitly instructs otherwise.
|
|
41
|
+
|
|
42
|
+
### Protocol cells
|
|
43
|
+
|
|
44
|
+
Donna communicates its progress and requests by outputting inrofmation organized in "cells". There are two kinds of cells output:
|
|
45
|
+
|
|
46
|
+
- Log cells — `DONNA LOG: <log-message>` — one line messages describing what Donna is doing. Mostly it is an information about the next operation being executed.
|
|
47
|
+
- Info cells — multiline cells with structured header and freeform body.
|
|
48
|
+
|
|
49
|
+
An example of an info cell:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
--DONNA-CELL eZVkOwNPTHmadXpaHDUBNA BEGIN--
|
|
53
|
+
kind=action_request
|
|
54
|
+
media_type=text/markdown
|
|
55
|
+
action_request_id=AR-65-bd
|
|
56
|
+
|
|
57
|
+
<here goes the multiline markdown content of the action request>
|
|
58
|
+
|
|
59
|
+
--DONNA-CELL eZVkOwNPTHmadXpaHDUBNA END--
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Donna can omit log cell start and end markers if a command produces only a single cell.
|
|
63
|
+
|
|
64
|
+
Donna renders cells differently, depending on the protocol used.
|
|
65
|
+
|
|
66
|
+
### Commands
|
|
67
|
+
|
|
68
|
+
There are three sets of commands:
|
|
69
|
+
|
|
70
|
+
- `donna -p <protocol> workspaces …` — manages workspaces. Most-likely it will be used once per your project to initialize it.
|
|
71
|
+
- `donna -p <protocol> sessions …` — manages sessions. You will use these commands to start, push forward, and manage your work.
|
|
72
|
+
- `donna -p <protocol> artifacts …` — manages artifacts. You will use these commands to read and update artifacts you are working with.
|
|
73
|
+
|
|
74
|
+
Use:
|
|
75
|
+
|
|
76
|
+
- `donna -p <protocol> <command> --help` to get the list of available subcommands.
|
|
77
|
+
- `donna -p <protocol> <command> <subcommand> --help` to get the help on specific subcommand.
|
|
78
|
+
|
|
79
|
+
### Workspaces
|
|
80
|
+
|
|
81
|
+
Run `donna -p <protocol> workspaces init [<directory-path>]` to initialize Donna workspace in the given directory. If `<directory-path>` is omitted, Donna will initialize workspace in the current working directory.
|
|
82
|
+
|
|
83
|
+
It is a one time operation you need to perform once per project to create a place where Donna will store all its data.
|
|
84
|
+
|
|
85
|
+
### Starting sessions
|
|
86
|
+
|
|
87
|
+
The developer is responsible for starting a new session.
|
|
88
|
+
|
|
89
|
+
You are allowed to start a new session in the next cases:
|
|
90
|
+
|
|
91
|
+
1. There is no active session.
|
|
92
|
+
2. The developer explicitly instructed you to start a new session.
|
|
93
|
+
|
|
94
|
+
You start session by calling `donna -p <protocol> sessions start`.
|
|
95
|
+
|
|
96
|
+
### Session flow
|
|
97
|
+
|
|
98
|
+
After the session starts you MUST follow the next workflow to perform your work:
|
|
99
|
+
|
|
100
|
+
1. List all possible workflows with command `donna -p <protocol> artifacts list`.
|
|
101
|
+
2. Choose the most appropriate workflow for the task you are going to work on or ask the developer if you are not sure which workflow to choose.
|
|
102
|
+
3. Start chosen workflow by calling `donna -p <protocol> sessions run <workflow-id>`.
|
|
103
|
+
4. Donna will output descriptions of all operations it performs to complete the work.
|
|
104
|
+
5. Donna will output **action requests** that you MUST perform. You MUST follow these instructions precisely.
|
|
105
|
+
6. When you done processing an action request, call `donna -p <protocol> sessions action-request-completed <action-request-id> <next-full-operation-id>` to report request completion. `<next-full-operation-id>` MUST contain full identifier of the next operation, like `<world>:<artifact>:<operation-id>`.
|
|
106
|
+
7. After you complete an action request, Donna will continue workflow execution and output what you need to do next.
|
|
107
|
+
|
|
108
|
+
You MUST continue following Donna's instructions until the workflow is completed.
|
|
109
|
+
|
|
110
|
+
### Session state
|
|
111
|
+
|
|
112
|
+
- `donna -p <protocol> sessions status` — get the status of the current session.
|
|
113
|
+
- `donna -p <protocol> sessions details` — get detailed information about the current session, including list of active action requests.
|
|
114
|
+
- `donna -p <protocol> sessions start` — start a new session. This command resets session state AND removes all session-level artifacts.
|
|
115
|
+
- Run `donna -p <protocol> sessions reset` to reset the current session. This command resets session state BUT keeps all session-level artifacts. Use this command when you need to restart the worklow but keep all the artifacts you created during the session.
|
|
52
116
|
|
|
53
117
|
### Starting work
|
|
54
118
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
119
|
+
If the developer asked you to do something new:
|
|
120
|
+
|
|
121
|
+
- Run `donna -p <protocol> sessions status` to get the status of the current session.
|
|
122
|
+
- If there is no active session, start a new session by calling `donna -p <protocol> sessions start`.
|
|
123
|
+
- If the session is active and there are unfinished work in it, you MUST ask the developer whether to continue the work in the current session or start a new one.
|
|
124
|
+
- If the session is active and there are no unfinished work in it, follow the instructions in the `Session flow` section to choose and start a new workflow.
|
|
125
|
+
|
|
126
|
+
### Continuing work
|
|
127
|
+
|
|
128
|
+
If the developer asked you to continue your work, you MUST call `donna -p <protocol> sessions continue` to get your instructions on what to do next.
|
|
129
|
+
|
|
130
|
+
If Donna tells you there is no work left, you MUST inform the developer that there is no work left in the current session.
|
|
62
131
|
|
|
63
132
|
### Working with artifacts
|
|
64
133
|
|
|
65
134
|
An artifact is a markdown document with extra metadata stored in one of the Donna's worlds.
|
|
66
135
|
|
|
67
|
-
Use the next commands to work with artifacts
|
|
136
|
+
Use the next commands to work with artifacts:
|
|
68
137
|
|
|
69
|
-
- `donna -p <protocol> artifacts list [
|
|
70
|
-
- `donna -p <protocol> artifacts view <
|
|
71
|
-
- `donna -p <protocol> artifacts fetch <world>:<artifact>` — download the original source of the artifact content, outputs the file path to the artifact's copy you can change. Use this command when you need to change the content of the artifact.
|
|
138
|
+
- `donna -p <protocol> artifacts list [<artifact-pattern>]` — list all artifacts corresponding to the given pattern. If `<artifact-pattern>` is omitted, list all artifacts in all worlds. Use this command when you need to find an artifact or see what artifacts are available.
|
|
139
|
+
- `donna -p <protocol> artifacts view <artifact-pattern>` — get the meaningful (rendered) content of all matching artifacts. This command shows the rendered information about each artifact. Use this command when you need to read artifact content.
|
|
140
|
+
- `donna -p <protocol> artifacts fetch <world>:<artifact>` — download the original source of the artifact content, outputs the file path to the artifact's copy, you can change. Use this command when you need to change the content of the artifact.
|
|
141
|
+
- `donna -p <protocol> artifacts tmp <slug>.<extension>` — create a temporary file for artifact-related work and output its path.
|
|
72
142
|
- `donna -p <protocol> artifacts update <world>:<artifact> <file-path>` — upload the given file as the artifact. Use this command when you finished changing the content of the artifact.
|
|
143
|
+
- `donna -p <protocol> artifacts copy <artifact-id-from> <artifact-id-to>` — copy an artifact source to another artifact ID (can be in a different world). This overwrites the destination if it exists.
|
|
144
|
+
- `donna -p <protocol> artifacts move <artifact-id-from> <artifact-id-to>` — copy an artifact source to another artifact ID and remove the original. This overwrites the destination if it exists.
|
|
145
|
+
- `donna -p <protocol> artifacts remove <artifact-pattern>` — remove artifacts matching a pattern. Use this command when you need to delete artifacts.
|
|
73
146
|
- `donna -p <protocol> artifacts validate <world>:<artifact>` — validate the given artifact to ensure it is correct and has no issues.
|
|
74
|
-
- `donna -p <protocol> artifacts validate-all [
|
|
147
|
+
- `donna -p <protocol> artifacts validate-all [<artifact-pattern>]` — validate all artifacts corresponding to the given pattern. If `<artifact-pattern>` is omitted, validate all artifacts in all worlds.
|
|
148
|
+
|
|
149
|
+
Commands that accept an artifact pattern (`artifacts list`, `artifacts view`, `artifacts remove`, `artifacts validate-all`) also accept a repeatable `--tag <tag>` option to filter by artifact tags. When multiple tags are provided, only artifacts that include **all** specified tags are matched.
|
|
75
150
|
|
|
76
151
|
The format of `<artifact-pattern>` is as follows:
|
|
77
152
|
|
|
@@ -95,7 +170,7 @@ The format of `<artifact-pattern>` is as follows:
|
|
|
95
170
|
3. Specifications in `project:` world.
|
|
96
171
|
4. This document.
|
|
97
172
|
|
|
98
|
-
**All Donna CLI commands MUST include an explicit protocol selection using `-p <
|
|
173
|
+
**All Donna CLI commands MUST include an explicit protocol selection using `-p <protocol>`.** Like `donna -p llm <command>`.
|
|
99
174
|
|
|
100
175
|
**Pass text arguments to the tool in quotes with respect to escaping.** The tool MUST receive the exact text you want to pass as an argument.
|
|
101
176
|
|