agnostic-prompt-aps 1.1.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.
Files changed (42) hide show
  1. agnostic_prompt_aps-1.1.1.dist-info/METADATA +57 -0
  2. agnostic_prompt_aps-1.1.1.dist-info/RECORD +42 -0
  3. agnostic_prompt_aps-1.1.1.dist-info/WHEEL +5 -0
  4. agnostic_prompt_aps-1.1.1.dist-info/entry_points.txt +2 -0
  5. agnostic_prompt_aps-1.1.1.dist-info/licenses/LICENSE +190 -0
  6. agnostic_prompt_aps-1.1.1.dist-info/top_level.txt +1 -0
  7. aps_cli/__init__.py +3 -0
  8. aps_cli/cli.py +250 -0
  9. aps_cli/core.py +157 -0
  10. aps_cli/payload/agnostic-prompt-standard/SKILL.md +73 -0
  11. aps_cli/payload/agnostic-prompt-standard/assets/agents/vscode-agent-v1.0.0.agent.md +187 -0
  12. aps_cli/payload/agnostic-prompt-standard/assets/constants/constants-json-block-v1.0.0.example.md +15 -0
  13. aps_cli/payload/agnostic-prompt-standard/assets/constants/constants-text-block-v1.0.0.example.md +15 -0
  14. aps_cli/payload/agnostic-prompt-standard/assets/formats/format-code-changes-full-v1.0.0.example.md +21 -0
  15. aps_cli/payload/agnostic-prompt-standard/assets/formats/format-code-map-v1.0.0.example.md +18 -0
  16. aps_cli/payload/agnostic-prompt-standard/assets/formats/format-error-v1.0.0.example.md +9 -0
  17. aps_cli/payload/agnostic-prompt-standard/assets/formats/format-hierarchical-outline-v1.0.0.example.md +17 -0
  18. aps_cli/payload/agnostic-prompt-standard/assets/formats/format-ideation-list-v1.0.0.example.md +20 -0
  19. aps_cli/payload/agnostic-prompt-standard/assets/formats/format-markdown-table-v1.0.0.example.md +17 -0
  20. aps_cli/payload/agnostic-prompt-standard/assets/formats/format-table-api-coverage-v1.0.0.example.md +13 -0
  21. aps_cli/payload/agnostic-prompt-standard/platforms/README.md +39 -0
  22. aps_cli/payload/agnostic-prompt-standard/platforms/_schemas/platform-manifest.schema.json +84 -0
  23. aps_cli/payload/agnostic-prompt-standard/platforms/_schemas/tools-registry.schema.json +148 -0
  24. aps_cli/payload/agnostic-prompt-standard/platforms/_template/README.md +10 -0
  25. aps_cli/payload/agnostic-prompt-standard/platforms/_template/manifest.json +25 -0
  26. aps_cli/payload/agnostic-prompt-standard/platforms/_template/tools-registry.json +12 -0
  27. aps_cli/payload/agnostic-prompt-standard/platforms/vscode-copilot/README.md +100 -0
  28. aps_cli/payload/agnostic-prompt-standard/platforms/vscode-copilot/frontmatter/agent-frontmatter.md +24 -0
  29. aps_cli/payload/agnostic-prompt-standard/platforms/vscode-copilot/frontmatter/instructions-frontmatter.md +12 -0
  30. aps_cli/payload/agnostic-prompt-standard/platforms/vscode-copilot/frontmatter/prompt-frontmatter.md +18 -0
  31. aps_cli/payload/agnostic-prompt-standard/platforms/vscode-copilot/frontmatter/skill-frontmatter.md +10 -0
  32. aps_cli/payload/agnostic-prompt-standard/platforms/vscode-copilot/manifest.json +40 -0
  33. aps_cli/payload/agnostic-prompt-standard/platforms/vscode-copilot/templates/AGENTS.md +7 -0
  34. aps_cli/payload/agnostic-prompt-standard/platforms/vscode-copilot/tools-registry.json +509 -0
  35. aps_cli/payload/agnostic-prompt-standard/references/00-structure.md +123 -0
  36. aps_cli/payload/agnostic-prompt-standard/references/01-vocabulary.md +124 -0
  37. aps_cli/payload/agnostic-prompt-standard/references/02-linting-and-formatting.md +122 -0
  38. aps_cli/payload/agnostic-prompt-standard/references/03-agentic-control.md +192 -0
  39. aps_cli/payload/agnostic-prompt-standard/references/04-schemas-and-types.md +137 -0
  40. aps_cli/payload/agnostic-prompt-standard/references/05-grammar.md +99 -0
  41. aps_cli/payload/agnostic-prompt-standard/references/06-logging-and-privacy.md +32 -0
  42. aps_cli/payload/agnostic-prompt-standard/references/07-error-taxonomy.md +62 -0
@@ -0,0 +1,124 @@
1
+ # 01 Vocabulary
2
+
3
+ This document defines the **normative language** and the authoring vocabulary constraints used
4
+ throughout APS.
5
+
6
+ ## Normative terms
7
+
8
+ RFC 2119 terms **MUST**, **MUST NOT**, **SHOULD**, **SHOULD NOT**, **MAY** are normative.
9
+
10
+ ## Text types
11
+
12
+ The following text types are normative and MAY be used to classify prose within a prompt or its
13
+ supporting documentation:
14
+
15
+ ```yaml
16
+ text_types:
17
+ - Procedure
18
+ - Description
19
+ - Safety
20
+ - Observation
21
+ - Requirement
22
+ - Definition
23
+ - Declaration
24
+ - Constraint
25
+ - Conditional
26
+ ```
27
+
28
+ ## Tense and voice
29
+
30
+ ```yaml
31
+ tense_voice:
32
+ allowed_verbs:
33
+ - infinitive
34
+ - imperative
35
+ - simple_present
36
+ - simple_past
37
+ - simple_future_will
38
+ disallowed:
39
+ - progressive
40
+ - perfect
41
+ - going_to_future
42
+ procedures: active_only
43
+ descriptions: passive_only_if_agent_unknown
44
+ ```
45
+
46
+ ## Dictionary and terminology
47
+
48
+ - Authors SHOULD use approved words from a Dictionary with approved POS/meaning.
49
+ - Technical terms are allowed if defined on first use and linked by `term_id` and `lexicon_edition`.
50
+ - Multi-word nouns MUST be ≤ 3 words unless explicitly whitelisted.
51
+
52
+ ## Identifiers
53
+
54
+ In general, specification identifiers SHOULD be short, ASCII, and consistent.
55
+
56
+ ```yaml
57
+ identifiers:
58
+ # Applies to glossary / lexicon identifiers and similar spec IDs.
59
+ spec_ids:
60
+ style: UpperCamel_Segments
61
+ ascii_only: true
62
+ no_hyphens: true
63
+ max_length: 30
64
+ ```
65
+
66
+ > NOTE: Process/tool identifiers, symbols, and placeholders used by the agentic control DSL have
67
+ > their own stricter patterns; see **03 Agentic control**.
68
+
69
+ ## Sentence, paragraph, and list limits
70
+
71
+ ```yaml
72
+ sentence_limits:
73
+ procedures: 20
74
+ descriptions: 25
75
+
76
+ paragraph_limits:
77
+ sentences_max: 6
78
+ one_topic: true
79
+
80
+ lists:
81
+ steps_numbered: true
82
+ supportive_bullets: true
83
+ ```
84
+
85
+ ## Numbers, units, and time
86
+
87
+ ```yaml
88
+ numbers_units_time:
89
+ numbers:
90
+ decimals: "."
91
+ thousands: "U+2009 (thin space)"
92
+
93
+ units:
94
+ format: "<number><space><unit>"
95
+ percent: "50 %"
96
+ temperature: "60 °C"
97
+ symbols: middle_dot_between_compounds # U+00B7
98
+ catalog: units.json (project)
99
+
100
+ time:
101
+ iso8601: true
102
+ default_tz: "Z"
103
+ local_times_require_offset_or_iana: true
104
+ ```
105
+
106
+ ## Safety vocabulary
107
+
108
+ ```yaml
109
+ safety:
110
+ taxonomy: [WARNING, CAUTION, NOTICE]
111
+ wrapper: SAF
112
+ imperative_required: true
113
+ ```
114
+
115
+ ## `<instructions>` line discipline
116
+
117
+ Inside `<instructions>`:
118
+
119
+ - Instructions MUST use **one directive per line**.
120
+ - Each line MUST be a single imperative or declarative that changes system behavior.
121
+ - Multiple sentences per line are forbidden.
122
+ - Blank lines inside `<instructions>` are forbidden.
123
+
124
+ The engine/LSP MUST raise `AG-033` when this policy is violated.
@@ -0,0 +1,122 @@
1
+ # 02 Linting and formatting
2
+
3
+ This document defines the **compile-time and lint-time** formatting rules.
4
+
5
+ ## Newlines and XML-like tags
6
+
7
+ Newline rule (normative):
8
+
9
+ - There MUST be exactly one newline after an opening XML-like tag.
10
+ - There MUST be exactly one newline before a closing XML-like tag.
11
+
12
+ This applies to top-level sections (`<instructions>`, `<constants>`, `<formats>`, `<runtime>`,
13
+ `<triggers>`, `<processes>`, `<input>`) and to nested tags like `<format>` and `<process>`.
14
+
15
+ ## Tabs and whitespace
16
+
17
+ - Tab characters (`\t`) are forbidden anywhere in a prompt. Tabs MUST raise `AG-011`.
18
+ - Engines MUST treat excessive inter-token padding whitespace as a compile error (`AG-031`) when
19
+ compiled/normalized form requires exactly one ASCII space.
20
+
21
+ ## Comments
22
+
23
+ Comments are denoted by `//` at the start of the line and are for explanatory purposes only.
24
+
25
+ ### Comment stripping
26
+
27
+ If an engine implements comment stripping, it MUST:
28
+
29
+ - Remove any full line whose first two non-whitespace characters are `//`.
30
+ - NOT strip comments inside block constant bodies (see below).
31
+
32
+ ### Where comments are forbidden
33
+
34
+ - Comments are forbidden inside **executable blocks**: `<triggers>` and `<processes>` (including
35
+ inside each `<process>` body). A detected comment in an executable block MUST raise `AG-010`.
36
+
37
+ ## Unicode and quotes
38
+
39
+ - Prompts MUST be NFC normalized.
40
+ - Strings MUST use ASCII double quotes (`"`) only. Smart quotes are forbidden.
41
+
42
+ ## Canonical JSON spacing
43
+
44
+ Engines that compile or canonicalize JSON MUST emit **canonical JSON** using the rules below:
45
+
46
+ - After `:`, exactly one ASCII space.
47
+ - After `,`, exactly one ASCII space.
48
+ - No interior spaces immediately inside `{` `}` `[` `]`.
49
+ - Empty containers are `{}` and `[]`.
50
+ - Keys in objects MUST be in lexicographic order.
51
+
52
+ Source form inside JSON block constants MAY contain arbitrary newlines/indentation, but engines
53
+ MUST parse and re-emit canonical JSON at compile time.
54
+
55
+ ## `where:` key ordering
56
+
57
+ In `where:` parameter lists, keys MUST appear in lexicographic order. Violation → `AG-012`.
58
+
59
+ ## Backticked ids
60
+
61
+ Process and tool ids in statements MUST be wrapped in backticks.
62
+
63
+ Examples:
64
+
65
+ - `RUN \`process_id\``
66
+ - `USE \`tool_name\``
67
+
68
+ Violation → `AG-003` (InvalidId).
69
+
70
+ ## Constants inside JSON values
71
+
72
+ An `UpperSym` appearing inside JSON objects/arrays denotes a **constant symbol reference**.
73
+ Engines MUST resolve it from `<constants>` before execution or raise `AG-006`.
74
+
75
+ ## Block constants
76
+
77
+ Block constants are allowed only inside `<constants>` (see **00 Structure**).
78
+
79
+ Rules:
80
+
81
+ - Block constant opening line MUST be `SYMBOL: JSON<<` or `SYMBOL: TEXT<<` (exactly one ASCII space
82
+ after `:`).
83
+ - Block constant BODY is line-oriented and terminates at the first line whose content is exactly
84
+ `>>` starting at column 1.
85
+ - Comment stripping (`//`) MUST NOT apply inside block constant BODY.
86
+ - Unknown `<BLOCK_TYPE>` → `AG-046`.
87
+ - Missing closing delimiter `>>` → `AG-045`.
88
+
89
+ ## Format blocks
90
+
91
+ Rendered format outputs MUST be wrapped in a fenced code block whose info string is exactly
92
+ `format:<ID>` where `<ID>` matches a defined `<format id="...">`.
93
+
94
+ Rules:
95
+
96
+ - The fence MUST start at column 1.
97
+ - For any step that requires a format, the agent MUST emit exactly one `format:<ID>` fenced block.
98
+ Multiple blocks or surrounding prose → `AG-040`.
99
+
100
+ ### WHERE discipline (format contracts)
101
+
102
+ Every rendered format block MUST include a terminating `WHERE:` section.
103
+
104
+ Each `<PLACEHOLDER>` token that appears in the body MUST have exactly one definition line in
105
+ `WHERE:`. No extra definitions are allowed.
106
+
107
+ - Missing/extra/mismatched definitions → `AG-041` / `AG-042`.
108
+ - Placeholders MUST be `<UPPER_SNAKE>`; any other style → `AG-043`.
109
+
110
+ ## RETURN values
111
+
112
+ `RETURN` supports:
113
+
114
+ - Symbol lists
115
+ - `key=value` pairs
116
+ - Artifact references of the form:
117
+
118
+ ```json
119
+ {"$artifact":"SYMBOL","hash":"sha256:..."}
120
+ ```
121
+
122
+ See **03 Agentic control** and **05 Grammar** for executable syntax.
@@ -0,0 +1,192 @@
1
+ # 03 Agentic control
2
+
3
+ This document defines the **agentic control DSL** used inside `<process>` bodies.
4
+
5
+ ## Keywords
6
+
7
+ ```yaml
8
+ keywords:
9
+ control: [GIVEN, WHEN, IF, ELSE IF, ELSE, THEN]
10
+ actions: [RUN, USE, CAPTURE, SET, UNSET, RETURN, ASSERT]
11
+ story: [TELL, SNAP, MILESTONE]
12
+ blocks: [WITH, PAR, JOIN]
13
+ modifiers: [atomic, timeout_ms, retry]
14
+ ```
15
+
16
+ ## Identifiers and reserved tokens
17
+
18
+ ```yaml
19
+ identifiers:
20
+ symbol:
21
+ regex: "^[A-Z0-9_]{2,24}$"
22
+ unique: true
23
+
24
+ process_id:
25
+ regex: "^[a-z][a-z0-9_-]{1,63}$"
26
+ unique: true
27
+
28
+ tool_name:
29
+ regex: "^[a-z][a-z0-9_-]{1,63}$"
30
+ registered_by_engine: true
31
+
32
+ placeholder:
33
+ syntax: "<UPPER_SNAKE>"
34
+ charset: "A-Z0-9_"
35
+ resolvable: true
36
+
37
+ reserved:
38
+ - GIVEN
39
+ - WHEN
40
+ - IF
41
+ - ELSE
42
+ - THEN
43
+ - RUN
44
+ - USE
45
+ - SET
46
+ - CAPTURE
47
+ - RETURN
48
+ - ASSERT
49
+ - SHOULD
50
+ - MAY
51
+ - AND
52
+ - OR
53
+ - NOT
54
+ - WITH
55
+ - PAR
56
+ - JOIN
57
+ - TELL
58
+ - SNAP
59
+ - MILESTONE
60
+ ```
61
+
62
+ Reserved words cannot be used as ids/keys/symbols (`AG-002`).
63
+
64
+ ## Strings, booleans, and numbers
65
+
66
+ ```yaml
67
+ strings_booleans_numbers:
68
+ strings:
69
+ quote: double_only
70
+ booleans: [true, false]
71
+ numbers:
72
+ grammar: JSON_number
73
+ thousands: forbidden
74
+ ```
75
+
76
+ ## Determinism
77
+
78
+ - External `USE` invocations SHOULD be idempotent; engines MAY deduplicate based on a stable hash
79
+ of inputs.
80
+ - `CAPTURE` is the binding point; `USE` does not mutate the symbol table by itself.
81
+
82
+ ## Storytelling
83
+
84
+ These statements produce narrative/logging events and are not allowed to change program state
85
+ except as explicitly defined by the engine:
86
+
87
+ - `TELL`: emits a narrative event (what/why/outcome/level).
88
+ - `SNAP`: snapshots selected symbols; supports delta and redact lists.
89
+ - `MILESTONE`: semantic checkpoint message (sugar for `TELL` with `type="milestone"`).
90
+
91
+ ## WITH block
92
+
93
+ - `WITH {defaults}:` applies key/value defaults (e.g., `endpoint=...`) to enclosed `RUN`/`USE`/
94
+ `CAPTURE` until the block end.
95
+ - Nested `WITH` blocks shadow outer defaults; scope does not leak across the closing boundary.
96
+
97
+ ## PAR / JOIN concurrency
98
+
99
+ `PAR` and `JOIN` define deterministic concurrency:
100
+
101
+ - `PAR:` launches one-or-more `USE` statements concurrently in **lexical order**; each child gets
102
+ index `[0..n-1]`.
103
+ - `JOIN:` is the first legal point to `CAPTURE` results of prior PAR tools.
104
+ - `CAPTURE` order MUST follow the **lexical order** of the corresponding `USE` statements,
105
+ regardless of completion time.
106
+ - If any child fails hard, `JOIN` raises a composite error including the first hard error and
107
+ aggregates others as `suppressed`.
108
+
109
+ Engines SHOULD log deterministic span indices and MUST NOT perform speculative execution.
110
+
111
+ ## Invocation syntax (normative)
112
+
113
+ The following describes statement syntax at a human-readable level. The authoritative grammar is
114
+ in **05 Grammar**.
115
+
116
+ ```text
117
+ RUN `process_id` [where: k1=V1, ...].
118
+
119
+ USE `tool_name` [where: k1=V1, ...] [(atomic[, timeout_ms=NUM][, retry=NUM])].
120
+
121
+ CAPTURE S1[, S2 ...] from `tool_name` [map: "path1"→S1, "path2?"→S2 ...].
122
+ - Optional field via suffix '?'; no error if missing; symbol unchanged.
123
+
124
+ SET SYMBOL := VALUE [(from SOURCE)]
125
+ - SOURCE ∈ { `tool`, INP, UpperSym, "Agent Inference" }
126
+
127
+ UNSET SYMBOL.
128
+
129
+ RETURN: SYMBOL[, SYMBOL...].
130
+ RETURN: key=VALUE[, key=VALUE ...].
131
+ - VALUE may be an artifact reference: {"$artifact":"SYMBOL","hash":"sha256:..."}.
132
+
133
+ ASSERT <condition>.
134
+ ASSERT ALL: [ <condition>, <condition>, ... ].
135
+
136
+ TELL "message" [why:SYMBOL] [level={brief|full}] [outcome:"text"].
137
+ MILESTONE "title".
138
+
139
+ SNAP [SYM1, SYM2 ...] [delta=true|false] [redact=[SYM_A, SYM_B ...]].
140
+ ```
141
+
142
+ ## Arguments and values
143
+
144
+ ```yaml
145
+ arguments:
146
+ allowed_values:
147
+ - String
148
+ - Number
149
+ - Boolean
150
+ - JSON
151
+ - UpperSym
152
+ - <PLACEHOLDER>
153
+ - enum(V1,V2,...)
154
+
155
+ choice_sets: "{V1|V2|...} allowed in spec text where indicated; engine turns into enum() at compile time."
156
+ const_refs: "UpperSym MAY appear inside JSON objects/arrays and are resolved from <constants>."
157
+ enums: "enum(A,B,...) becomes a choice set for validation."
158
+ ```
159
+
160
+ ## Placeholder resolution
161
+
162
+ ```yaml
163
+ placeholder_resolution:
164
+ order: [INP, CONSTANTS, RUNTIME, Agent Inference (only if allowed)]
165
+ allow_agent_inference_placeholders: false
166
+ ```
167
+
168
+ Rules:
169
+
170
+ - Unresolved placeholder → `AG-006`.
171
+ - If inference occurs under a non-strict policy, the engine MUST emit `AG-W03` with the inferred
172
+ value and a deterministic input hash in the invocation log.
173
+
174
+ ## Naming policy
175
+
176
+ - IDs/keys MUST be lowercase.
177
+ - Symbols MUST be `UPPER_SNAKE`.
178
+ - Reserved words cannot be used as IDs/keys/symbols (`AG-002`).
179
+
180
+ ## Safety policy
181
+
182
+ ```yaml
183
+ safety_policy:
184
+ defaults: { THR: 0.90, HARM_THR: 0.40 }
185
+ predicate: HARM := (HSC ≥ HARM_THR) OR (STY_JSON.policy_violation = true)
186
+ decision:
187
+ IF TS ≥ THR AND HARM=false: REC := "PROCEED"
188
+ ELSE IF NPR != "": REC := "PROCEED_WITH_CAUTION"
189
+ ELSE: REC := "HOLD_FOR_REVIEW"
190
+ log_thresholds: true
191
+ randomness: forbidden unless seed provided; otherwise AG-022 (RandomnessPolicy) if policy enabled.
192
+ ```
@@ -0,0 +1,137 @@
1
+ # 04 Schemas and types
2
+
3
+ This document defines the **schemas** and reusable **type contracts** used by APS.
4
+
5
+ ## Formats registry
6
+
7
+ The `<formats>` section centralizes all human-readable output contracts that a prompt may ask the
8
+ agent to render. This ensures outputs are verifiable, stable, and machine-checkable.
9
+
10
+ ### Requirements
11
+
12
+ - All format contracts used anywhere in `<instructions>`, `<triggers>`, or `<processes>` MUST be
13
+ declared inside a single `<formats>` section using one-or-more `<format>` tags.
14
+ - Each `<format>` MUST have a globally unique `id` within the prompt; `name` and `purpose`
15
+ attributes are RECOMMENDED.
16
+ - The body of each `<format>` MUST describe the contract unambiguously (headers, columns,
17
+ wrappers, markers, row grammar, allowed values).
18
+ - Rendered output MUST be a single fenced block starting with the exact fence label:
19
+
20
+ ```
21
+ ```format:<FORMAT_ID>
22
+ ```
23
+
24
+ (No spaces around the colon.)
25
+
26
+ - No explanatory prose MAY appear outside the fenced block for a step that demands a format.
27
+ - If a step references a format id that is not present in `<formats>` → `AG-039`.
28
+ - If the rendered block does not satisfy the contract → `AG-036`.
29
+ - If the block is not wrapped with the required ```format:<ID> fence → `AG-040`.
30
+
31
+ ### Structure
32
+
33
+ Tag syntax:
34
+
35
+ ```text
36
+ <format id="ID" [name="..."...] [purpose="..."]>
37
+
38
+ </format>
39
+ ```
40
+
41
+ Newline rules apply to `<formats>` and each `<format>` (see **02 Linting and formatting**).
42
+
43
+ ### Placeholders and WHERE
44
+
45
+ Placeholders and WHERE sections are normative (see also **02 Linting and formatting**):
46
+
47
+ - Placeholders that appear in the contract body MUST be written as `<UPPER_SNAKE>` using ASCII and
48
+ `UPPER_SNAKE` case.
49
+ - Every `<format>` body MUST end with a `WHERE:` section that defines each placeholder exactly
50
+ once.
51
+ - Each WHERE definition line MUST begin with `- <PLACEHOLDER> …` and normatively constrain the
52
+ placeholder (e.g., “is …”, “∈ { … }”, “matches …”, “format: …”, “example: …”).
53
+ - No placeholder may appear in the body if it is not defined in WHERE → `AG-042`.
54
+ - No placeholder may be defined in WHERE if it does not appear in the body → `AG-042`.
55
+ - Any non-`<…>` placeholder notation (e.g., `{placeholder}`, `$PLACEHOLDER`) is forbidden →
56
+ `AG-043`.
57
+ - The literal keyword `WHERE:` MUST be uppercase and followed by a newline; inline WHERE text is
58
+ forbidden → `AG-041`.
59
+
60
+ ### Expression guidance inside WHERE (RECOMMENDED)
61
+
62
+ - Type: `is <type>` where `<type>` ∈ { String, Integer, Number, Boolean, ISO8601, Markdown, URI,
63
+ Path }.
64
+ - Choice: `∈ { V1, V2, … }` or `is one of: V1, V2, …`.
65
+ - Shape: `format: "## <TITLE> …"`, `table columns: | A | B | … |`, `regex: ^…$`.
66
+ - Cardinality: `is non-empty`, `is ≤ N chars`, `is comma-separated list of UpperSym`.
67
+
68
+ ### References and phrasing
69
+
70
+ Prompts SHOULD phrase requirements in `<instructions>` like:
71
+
72
+ > You MUST conform human-readable outputs to `<formats>` by rendering a single fenced block
73
+ > ```format:<ID>```.
74
+
75
+ ### Enforcement
76
+
77
+ - WHERE presence/quality and placeholder discipline are enforced at lint time.
78
+ - Violations map to `AG-041` / `AG-042` / `AG-043` or `AG-036` as applicable.
79
+
80
+ ## Result process pattern
81
+
82
+ Intent: provide a standard **results** process that summarizes execution across processes in a
83
+ pre-defined table for deterministic post-hoc analysis and artifact linking.
84
+
85
+ Prompts that adopt this pattern MUST:
86
+
87
+ 1. Define `TABLE_PROCESS_RESULTS_V1` inside `<formats>`.
88
+ 2. Include a terminal process (RECOMMENDED id: `results` or short `res`) that emits exactly one
89
+ fenced block ```format:TABLE_PROCESS_RESULTS_V1``` summarizing all processes in lexical order.
90
+ 3. Record, at minimum: ProcessId, Name, Status, StartedAt, EndedAt, DurationMs, Outcome,
91
+ Artifacts, Errors.
92
+
93
+ Status values MUST be one of: PENDING, RUNNING, OK, WARN, ERROR.
94
+
95
+ Timestamps MUST be ISO 8601 with "Z" or explicit offset.
96
+
97
+ Artifacts MUST list symbol names (comma-separated) that were RETURNed or CAPTUREd as outputs.
98
+
99
+ ## Supporting files (external)
100
+
101
+ These files are **external** and MUST NOT appear in the prompt:
102
+
103
+ - `config.json`: ALIAS only (see schema).
104
+ - `predefinedTools.json`: tool signatures for lint/IDE help (replaces schema.json).
105
+ - `units.json`: unit catalog used by STE layer.
106
+
107
+ Policies:
108
+
109
+ - If a host provides tools/config via higher-level system instructions, the engine MUST ignore any
110
+ duplicate local definitions to avoid prompt bloat.
111
+ - Embedding `<config>` or `<import>` tags in a prompt is a hard error (`AG-035`).
112
+
113
+ Style guidelines:
114
+
115
+ - For `predefinedTools.json`, prefer one tool object per line to improve diffs/merges (best
116
+ practice; not enforced).
117
+ - Engines that emit `predefinedTools.json` SHOULD preserve or adopt the one-line-per-tool layout;
118
+ engines MUST accept any valid JSON layout.
119
+
120
+ ## Example format contracts
121
+
122
+ - Minimal error contract: [../assets/formats/format-error-v1.0.0.example.md](../assets/formats/format-error-v1.0.0.example.md)
123
+ - API coverage table: [../assets/formats/format-table-api-coverage-v1.0.0.example.md](../assets/formats/format-table-api-coverage-v1.0.0.example.md)
124
+ - Code map: [../assets/formats/format-code-map-v1.0.0.example.md](../assets/formats/format-code-map-v1.0.0.example.md)
125
+ - Ideation list: [../assets/formats/format-ideation-list-v1.0.0.example.md](../assets/formats/format-ideation-list-v1.0.0.example.md)
126
+ - Hierarchical outline: [../assets/formats/format-hierarchical-outline-v1.0.0.example.md](../assets/formats/format-hierarchical-outline-v1.0.0.example.md)
127
+ - Markdown table: [../assets/formats/format-markdown-table-v1.0.0.example.md](../assets/formats/format-markdown-table-v1.0.0.example.md)
128
+ - Code changes full: [../assets/formats/format-code-changes-full-v1.0.0.example.md](../assets/formats/format-code-changes-full-v1.0.0.example.md)
129
+
130
+ ## Example constants
131
+
132
+ - JSON block constant example: [../assets/constants/constants-json-block-v1.0.0.example.md](../assets/constants/constants-json-block-v1.0.0.example.md)
133
+ - TEXT block constant example: [../assets/constants/constants-text-block-v1.0.0.example.md](../assets/constants/constants-text-block-v1.0.0.example.md)
134
+
135
+ ## Example agents
136
+
137
+ - VS Code orchestration agent: [../assets/agents/vscode-agent-v1.0.0.agent.md](../assets/agents/vscode-agent-v1.0.0.agent.md)
@@ -0,0 +1,99 @@
1
+ # 05 Grammar
2
+
3
+ This document defines the normative EBNF for the agentic control DSL.
4
+
5
+ > NOTE: This is a reference grammar. Engines MAY extend it, but prompts that claim APS v1.0
6
+ > conformance MUST remain within this grammar unless the host explicitly opts into extensions.
7
+
8
+ ## EBNF
9
+
10
+ ```ebnf
11
+ Letter = "A"…"Z" | "a"…"z" ;
12
+ Digit = "0"…"9" ;
13
+ Space = " " ;
14
+ Newline = "\n" ;
15
+ Tab = "\t" ;
16
+
17
+ UpperSym = ( "A"…"Z" | "0"…"9" | "_" ){2,24} ;
18
+ Placeholder = "<", ( "A"…"Z" | "0"…"9" | "_" ){1,64}, ">" ;
19
+ Bool = "true" | "false" ;
20
+ Number = "-"? Digit, { Digit }, [ ".", Digit, { Digit } ] ;
21
+ String = "\"", { <any char except " or \"> | "\\\"" | "\\\\" }, "\"" ;
22
+ EnumLit = "enum(", UpperSym, { ",", UpperSym }, ")" ;
23
+
24
+ BlockType = "JSON" | "TEXT" ;
25
+ BlockOpen = UpperSym, ":", Space, BlockType, "<<", EOL ;
26
+ BlockClose = ">>" ;
27
+ BlockValue = BlockType, "<<", EOL, { <any line except BlockClose>, EOL }, BlockClose ;
28
+
29
+ JsonKey = Letter, { Letter | Digit | "_" | "-" } ;
30
+ JsonValue = String | Number | Bool | "null" | JsonObj | JsonArr | UpperSym ;
31
+ JsonPair = "\"", JsonKey, "\"", ":", Space?, JsonValue ;
32
+ JsonObj = "{", Space?, [ JsonPair, { ",", Space?, JsonPair } ], Space?, "}" ;
33
+ JsonArr = "[", Space?, [ JsonValue, { ",", Space?, JsonValue } ], Space?, "]" ;
34
+
35
+ IdLower = Letter, { Letter | Digit | "_" | "-" } ;
36
+ Key = IdLower ;
37
+ Value = String | Number | Bool | JsonObj | JsonArr | UpperSym | Placeholder | EnumLit ;
38
+
39
+ StaticConst = UpperSym, ":", Space, ( Value | BlockValue ) ;
40
+
41
+ Param = Key, "=", Value ;
42
+ ParamList = Param, { ",", Space, Param } ;
43
+
44
+ BacktickId = "`", IdLower, "`" ;
45
+
46
+ RunStmt = "RUN", Space, BacktickId, [ Space, "where:", Space, ParamList ] ;
47
+ UseStmt = "USE", Space, BacktickId, [ Space, "where:", Space, ParamList ],
48
+ [ Space, "(", "atomic", [ ",", Space, "timeout_ms", "=", Number ], [ ",", Space, "retry", "=", Number ], ")" ] ;
49
+ CaptureStmt = "CAPTURE", Space, UpperSym, { ",", Space, UpperSym }, Space, "from", Space, BacktickId,
50
+ [ Space, "map:", Space, "\"", <path>, "\"", "→", UpperSym, { ",", Space, "\"", <path>, "\"", "→", UpperSym } ] ;
51
+ SetStmt = "SET", Space, UpperSym, Space, ":=", Space, Value, [ Space, "(", "from ", ( BacktickId | "INP" | UpperSym | "Agent Inference" ), ")" ] ;
52
+ UnsetStmt = "UNSET", Space, UpperSym ;
53
+ ReturnPairs = IdLower, "=", Value, { ",", Space, IdLower, "=", Value } ;
54
+ ReturnList = UpperSym, { ",", Space, UpperSym } ;
55
+ ReturnStmt = "RETURN", ":", Space, ( ReturnList | ReturnPairs ) ;
56
+ AssertStmt = "ASSERT", Space, <expr> | "ASSERT ALL:", Space, "[", <expr>, { ",", Space, <expr> }, "]" ;
57
+ TellStmt = "TELL", [ Space, String ], [ Space, "why:", UpperSym ], [ Space, "level=", ("brief" | "full") ], [ Space, "outcome:", String ] ;
58
+ MileStmt = "MILESTONE", Space, String ;
59
+
60
+ SnapList = "[", UpperSym, { ",", Space, UpperSym }, "]" ;
61
+ RedactList = "[", UpperSym, { ",", Space, UpperSym }, "]" ;
62
+ SnapStmt = "SNAP", Space, SnapList, [ Space, "delta", "=", Bool ], [ Space, "redact", "=", RedactList ] ;
63
+
64
+ IfStmt = "IF", Space, <expr>, ":" ;
65
+ ElseIfStmt = "ELSE IF", Space, <expr>, ":" ;
66
+ ElseStmt = "ELSE", ":" ;
67
+ WhenStmt = "WHEN", Space, <condition-text-no-colon>, ":" ;
68
+ GivenStmt = "GIVEN", Space, <condition-text-no-colon>, ":" ;
69
+
70
+ EOL = Newline ;
71
+ WithBlock = "WITH", Space, JsonObj, ":", EOL, { <indented Statement>, EOL } ;
72
+ ParBlock = "PAR", ":", EOL, { <indented UseStmt>, EOL } ;
73
+ JoinBlock = "JOIN", ":", EOL, { <indented CaptureStmt>, EOL } ;
74
+
75
+ ForEachStmt = "FOREACH", Space, IdLower, Space, "IN", Space, UpperSym, ":", EOL, { <indented Statement>, EOL } ;
76
+
77
+ TryBlock = "TRY", ":", EOL, { <indented Statement>, EOL },
78
+ "RECOVER", Space, "(", IdLower, ")", ":", EOL, { <indented Statement>, EOL } ;
79
+
80
+ WhereSection = "WHERE:", EOL, { WhereDef, EOL } ;
81
+ WhereDef = "- ", Placeholder, Space, Constraint ;
82
+ Constraint = TypeConst | EnumConst | FormatConst | RegexConst ;
83
+
84
+ TypeConst = "is", Space, ("String" | "Number" | "Boolean" | "ISO8601" | "URI" | "Path") ;
85
+ EnumConst = "is one of:", Space, Value, { ",", Space, Value } ;
86
+ FormatConst = "matches format:", Space, UpperSym ; # Recursive validation
87
+ RegexConst = "matches", Space, String ;
88
+
89
+ Statement = RunStmt | UseStmt | CaptureStmt | SetStmt | UnsetStmt | ReturnStmt | AssertStmt
90
+ | TellStmt | MileStmt | WithBlock | ParBlock | JoinBlock | ForEachStmt | TryBlock
91
+ | IfStmt | ElseIfStmt | ElseStmt | SnapStmt ;
92
+
93
+ Program = { Statement, EOL } ;
94
+ ```
95
+
96
+ ## Notes (non-normative)
97
+
98
+ - Indentation is significant for block bodies (`WITH`, `PAR`, `JOIN`, `TRY`, `FOREACH`).
99
+ - `<expr>` and `<path>` are intentionally unspecified in v1.0 and are engine-defined.