donna 0.2.0__py3-none-any.whl → 0.2.1__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 +271 -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 +41 -6
- donna/artifacts/usage/cli.md +106 -37
- 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 +7 -7
- 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 +4 -4
- donna/machine/sessions.py +12 -4
- donna/machine/state.py +2 -2
- 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 +13 -6
- 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 +7 -6
- donna/{world → workspaces}/templates.py +4 -4
- donna/{world → workspaces}/tmp.py +19 -1
- donna/{world → workspaces}/worlds/base.py +5 -2
- donna/{world → workspaces}/worlds/filesystem.py +23 -9
- donna/{world → workspaces}/worlds/python.py +12 -9
- {donna-0.2.0.dist-info → donna-0.2.1.dist-info}/METADATA +4 -1
- donna-0.2.1.dist-info/RECORD +92 -0
- {donna-0.2.0.dist-info → donna-0.2.1.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/worlds/__init__.py +0 -0
- 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.1.dist-info}/entry_points.txt +0 -0
- {donna-0.2.0.dist-info → donna-0.2.1.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 a problem or changes required.
|
|
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 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 take 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_planing") }}`.
|
|
24
|
+
3. Make a rough estimate of the complexity of the requested changes.
|
|
25
|
+
4. If the complexity is small, `{{ donna.lib.goto("fast_planing") }}`.
|
|
26
|
+
5. Otherwise, `{{ donna.lib.goto("create_rfc") }}`.
|
|
27
|
+
|
|
28
|
+
Examles 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 planing
|
|
37
|
+
|
|
38
|
+
```toml donna
|
|
39
|
+
id = "fast_planing"
|
|
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 on 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:exectute_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:exectute_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 the developer or parent workflow want 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 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 review the changes.
|
|
35
|
+
- A gate step to start review the deliverables.
|
|
36
|
+
- A step per deliverable to check if it exists and is correct. If the deliverable is missing or incorrect, step MUST specify how to fix it an goto to `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, 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 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 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 where 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.
|
|
@@ -36,9 +38,19 @@ Donna provides a set of special directives that can and MUST be used in the arti
|
|
|
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.
|
|
@@ -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
|
|
@@ -209,7 +229,21 @@ Routing rules:
|
|
|
209
229
|
When `save_stdout_to` and/or `save_stderr_to` are set, the operation stores captured output in the task context
|
|
210
230
|
under the specified variable names.
|
|
211
231
|
|
|
212
|
-
3. `donna.lib.
|
|
232
|
+
3. `donna.lib.output` operation kind emits its body as an output cell and then continues to the configured next step.
|
|
233
|
+
|
|
234
|
+
The body of the operation is rendered as an output cell during execution.
|
|
235
|
+
|
|
236
|
+
Configuration options:
|
|
237
|
+
|
|
238
|
+
```toml
|
|
239
|
+
id = "<operation_id>"
|
|
240
|
+
kind = "donna.lib.output"
|
|
241
|
+
next_operation_id = "<next_operation_id>" # required
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
4. `donna.lib.finish` operation kind indicates that the workflow is finished.
|
|
245
|
+
|
|
246
|
+
The body of the operation is rendered as an output cell before the workflow completes.
|
|
213
247
|
|
|
214
248
|
Each possible path through the workflow MUST end with this operation kind.
|
|
215
249
|
|
|
@@ -219,6 +253,7 @@ Donna provides multiple directives that MUST be used in the artifact source to e
|
|
|
219
253
|
|
|
220
254
|
Here they are:
|
|
221
255
|
|
|
222
|
-
1. `{{ "{{ donna.lib.view(<
|
|
223
|
-
2. `{{ "{{ donna.lib.
|
|
224
|
-
3. `{{ "{{ donna.lib.
|
|
256
|
+
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.
|
|
257
|
+
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.
|
|
258
|
+
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.
|
|
259
|
+
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,53 +12,116 @@ 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 ommit 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 sessions.
|
|
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
|
+
### Session flow
|
|
86
|
+
|
|
87
|
+
You start session by calling `donna -p <protocol> sessions start`.
|
|
88
|
+
|
|
89
|
+
After you started a session:
|
|
90
|
+
|
|
91
|
+
1. List all possible workflows with command `donna -p <protocol> artifacts list`.
|
|
92
|
+
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.
|
|
93
|
+
3. Start choosen workflow by calling `donna -p <protocol> sessions run <workflow-id>`.
|
|
94
|
+
4. Donna will output descriptions of all operations it performs to complete the work.
|
|
95
|
+
5. Donna will output **action requests** that you MUST perform. You MUST follow these instructions precisely.
|
|
96
|
+
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>`.
|
|
97
|
+
7. After you complete an action request, Donna will continue workflow execution and outputs what you need to do next.
|
|
98
|
+
|
|
99
|
+
You MUST continue following Donna's instructions until the workflow is completed.
|
|
100
|
+
|
|
101
|
+
### Session state
|
|
102
|
+
|
|
103
|
+
You may run `donna -p <protocol> sessions status` to get the status of the current session.
|
|
104
|
+
|
|
105
|
+
You may run `donna -p <protocol> sessions details` to get detailed information about the current session, including list of active action requests.
|
|
106
|
+
|
|
107
|
+
Run `donna -p <protocol> sessions start` to start fully new session. This command resets session state AND removes all session-level artifacts. Use this command when you need to start work from scratch.
|
|
108
|
+
|
|
109
|
+
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
110
|
|
|
53
111
|
### Starting work
|
|
54
112
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
113
|
+
If the developer asked you to do something new:
|
|
114
|
+
|
|
115
|
+
- Run `donna -p <protocol> sessions status` to get the status of the current session.
|
|
116
|
+
- If there is no active session, start a new session by calling `donna -p <protocol> sessions start`.
|
|
117
|
+
- If the session is already active and there are no unfinished work in it, start a new session by calling `donna -p <protocol> sessions start`.
|
|
118
|
+
- If the session is already 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.
|
|
119
|
+
|
|
120
|
+
### Continuing work
|
|
121
|
+
|
|
122
|
+
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.
|
|
123
|
+
|
|
124
|
+
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
125
|
|
|
63
126
|
### Working with artifacts
|
|
64
127
|
|
|
@@ -66,12 +129,18 @@ An artifact is a markdown document with extra metadata stored in one of the Donn
|
|
|
66
129
|
|
|
67
130
|
Use the next commands to work with artifacts
|
|
68
131
|
|
|
69
|
-
- `donna -p <protocol> artifacts list [
|
|
70
|
-
- `donna -p <protocol> artifacts view <
|
|
132
|
+
- `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.
|
|
133
|
+
- `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.
|
|
71
134
|
- `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.
|
|
135
|
+
- `donna -p <protocol> artifacts tmp <slug>.<extension>` — create a temporary file for artifact-related work and output its path.
|
|
72
136
|
- `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.
|
|
137
|
+
- `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.
|
|
138
|
+
- `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.
|
|
139
|
+
- `donna -p <protocol> artifacts remove <artifact-pattern>` — remove artifacts matching a pattern. Use this command when you need to delete artifacts.
|
|
73
140
|
- `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 [
|
|
141
|
+
- `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.
|
|
142
|
+
|
|
143
|
+
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
144
|
|
|
76
145
|
The format of `<artifact-pattern>` is as follows:
|
|
77
146
|
|
|
@@ -95,7 +164,7 @@ The format of `<artifact-pattern>` is as follows:
|
|
|
95
164
|
3. Specifications in `project:` world.
|
|
96
165
|
4. This document.
|
|
97
166
|
|
|
98
|
-
**All Donna CLI commands MUST include an explicit protocol selection using `-p <
|
|
167
|
+
**All Donna CLI commands MUST include an explicit protocol selection using `-p <protocol>`.** Like `donna -p llm <command>`.
|
|
99
168
|
|
|
100
169
|
**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
170
|
|
donna/artifacts/usage/worlds.md
CHANGED
|
@@ -22,7 +22,7 @@ s3 buckets, git repositories, databases, etc.
|
|
|
22
22
|
Default worlds and there locations are:
|
|
23
23
|
|
|
24
24
|
- `donna` — `donna.artifacts` — the subpackage with artifacts provided by Donna itself.
|
|
25
|
-
- `home` — `~/.donna/home` — the user-level donna artifacts, i.e. those that should be visible
|
|
25
|
+
- `home` — `~/.donna/home` — the user-level donna artifacts, i.e. those that should be visible for all workspaces on this machine.
|
|
26
26
|
- `project` — `<project-root>/.donna/project` — the project-level donna artifacts, i.e. those that are specific to this project.
|
|
27
27
|
- `session` — `<project-root>/.donna/session` — the session world that contains the current state of work performed by Donna.
|
|
28
28
|
|
|
@@ -33,4 +33,10 @@ All worlds have a free layout, defined by developers who own the particular worl
|
|
|
33
33
|
By default, worlds are read-only. Besides the next exceptions:
|
|
34
34
|
|
|
35
35
|
- `session` in the project world is read-write, Donna stores its current state of work here.
|
|
36
|
-
-
|
|
36
|
+
- `project` is read-write when the developer explicitly asks Donna to change it. For example, to add the result of performed work into docs.
|
|
37
|
+
|
|
38
|
+
## `<world>:intro` artifact
|
|
39
|
+
|
|
40
|
+
It is a recommended practice to provide a short introductory artifact `intro.md` at the root of each world.
|
|
41
|
+
|
|
42
|
+
So, the agent can load descriptions of all worlds in a single command like `donna -p llm artifacts view "*:intro"`.
|
donna/cli/__main__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from donna.cli.application import app # noqa: F401
|
|
2
2
|
from donna.cli.commands import artifacts # noqa: F401
|
|
3
|
-
from donna.cli.commands import projects # noqa: F401
|
|
4
3
|
from donna.cli.commands import sessions # noqa: F401
|
|
4
|
+
from donna.cli.commands import workspaces # noqa: F401
|
|
5
5
|
|
|
6
6
|
app()
|