@rqml/schema 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,158 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <rqml xmlns="https://rqml.org/schema/2.1.0"
3
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi:schemaLocation="https://rqml.org/schema/2.1.0 https://rqml.org/schema/rqml-2.1.0.xsd"
5
+ version="2.1.0" docId="ROBOT-001" status="draft">
6
+ <meta>
7
+ <title>Autonomous Warehouse Robots</title>
8
+ <system>FleetControl</system>
9
+ <summary>Fleet coordination, task assignment, and safety controls for warehouse AMRs.</summary>
10
+ <authors>
11
+ <author>
12
+ <name>Alex Morgan</name>
13
+ <role>Systems</role>
14
+ </author>
15
+ </authors>
16
+ </meta>
17
+
18
+ <catalogs>
19
+ <risks>
20
+ <risk id="RISK-COLLISION" severity="critical">
21
+ <statement>Collision between robots or with humans.</statement>
22
+ <mitigation>Real-time obstacle detection and braking.</mitigation>
23
+ </risk>
24
+ </risks>
25
+ <decisions>
26
+ <decision id="DEC-PLANNER" status="approved">
27
+ <context>Path planning approach</context>
28
+ <decision>Use A* with dynamic replanning</decision>
29
+ </decision>
30
+ </decisions>
31
+ </catalogs>
32
+
33
+ <domain>
34
+ <entities>
35
+ <entity id="ENT-ROBOT" name="Robot">
36
+ <attr id="ATTR-ID" name="robotId" type="uuid" required="true"/>
37
+ <attr id="ATTR-STATE" name="state" type="token" required="true"/>
38
+ </entity>
39
+ <entity id="ENT-TASK" name="Task">
40
+ <attr id="ATTR-TASK-ID" name="taskId" type="uuid" required="true"/>
41
+ <attr id="ATTR-PRIORITY" name="priority" type="token" required="false"/>
42
+ </entity>
43
+ <entity id="ENT-ZONE" name="Zone">
44
+ <attr id="ATTR-NAME" name="name" type="string" required="true"/>
45
+ </entity>
46
+ </entities>
47
+ </domain>
48
+
49
+ <goals>
50
+ <goal id="GOAL-THROUGHPUT" title="High throughput" priority="must">
51
+ <statement>Maximize picks per hour without sacrificing safety.</statement>
52
+ </goal>
53
+ <qgoal id="QGOAL-SAFETY" title="Safety" priority="must">
54
+ <statement>Zero collisions during operations.</statement>
55
+ </qgoal>
56
+ </goals>
57
+
58
+ <scenarios>
59
+ <scenario id="SCN-PICK" title="Pick and deliver">
60
+ <narrative>A robot receives a pick task and delivers items to a pack station.</narrative>
61
+ </scenario>
62
+ <edgeCase id="SCN-OBST" title="Obstacle in path">
63
+ <narrative>A robot encounters an unexpected obstacle mid-route.</narrative>
64
+ </edgeCase>
65
+ </scenarios>
66
+
67
+ <requirements>
68
+ <reqPackage id="PKG-FLEET" title="Fleet control">
69
+ <req id="REQ-ASSIGN" type="FR" title="Assign tasks" priority="must">
70
+ <statement>The system SHALL assign tasks to available robots based on proximity and load.</statement>
71
+ <acceptance>
72
+ <criterion id="CRIT-ASSIGN-1">
73
+ <when>A new task is created</when>
74
+ <then>It is assigned to an available robot within 2 seconds.</then>
75
+ </criterion>
76
+ </acceptance>
77
+ </req>
78
+ <req id="REQ-AVOID" type="SR" title="Collision avoidance" priority="must">
79
+ <statement>Robots SHALL detect obstacles and brake to avoid collision.</statement>
80
+ <acceptance>
81
+ <criterion id="CRIT-AVOID-1">
82
+ <when>An obstacle enters the safety radius</when>
83
+ <then>The robot decelerates and stops before impact.</then>
84
+ </criterion>
85
+ </acceptance>
86
+ </req>
87
+ <req id="REQ-LOG" type="DR" title="Telemetry logging" priority="should">
88
+ <statement>Robots SHALL log position, velocity, and battery every second.</statement>
89
+ </req>
90
+ <req id="REQ-RECOVERY" type="OR" title="Recovery" priority="should">
91
+ <statement>The system SHALL reassign tasks from offline robots within 5 seconds.</statement>
92
+ </req>
93
+ </reqPackage>
94
+ </requirements>
95
+
96
+ <interfaces>
97
+ <api id="API-CONTROL" name="Control API" protocol="https" auth="mTLS">
98
+ <endpoint id="EP-ASSIGN" method="POST" path="/tasks">
99
+ <summary>Create and assign a task.</summary>
100
+ <response>taskId, assignedRobotId</response>
101
+ </endpoint>
102
+ <endpoint id="EP-HEARTBEAT" method="POST" path="/robots/{id}/heartbeat">
103
+ <summary>Report robot telemetry.</summary>
104
+ <request>position, velocity, battery</request>
105
+ <response>200 ack</response>
106
+ </endpoint>
107
+ </api>
108
+ <event id="EVT-OBST" name="ObstacleDetected">
109
+ <description>Emitted when a robot detects an obstacle.</description>
110
+ <payload>robotId, position, timestamp</payload>
111
+ </event>
112
+ </interfaces>
113
+
114
+ <verification>
115
+ <testCase id="TC-ASSIGN" type="integration" title="Task assigned quickly">
116
+ <expected>Assignment occurs within 2 seconds</expected>
117
+ </testCase>
118
+ <testCase id="TC-AVOID" type="inspection" title="Obstacle avoidance">
119
+ <steps>Inject obstacle at 2m ahead during motion</steps>
120
+ <expected>Robot brakes and stops before impact</expected>
121
+ </testCase>
122
+ </verification>
123
+
124
+ <trace>
125
+ <edge id="TR-ASSIGN" type="satisfies">
126
+ <from><locator><local id="REQ-ASSIGN"/></locator></from>
127
+ <to><locator><local id="GOAL-THROUGHPUT"/></locator></to>
128
+ </edge>
129
+ <edge id="TR-ASSIGN-SCN" type="satisfies">
130
+ <from><locator><local id="REQ-ASSIGN"/></locator></from>
131
+ <to><locator><local id="SCN-PICK"/></locator></to>
132
+ </edge>
133
+ <edge id="TR-ASSIGN-ENT" type="dependsOn">
134
+ <from><locator><local id="REQ-ASSIGN"/></locator></from>
135
+ <to><locator><local id="ENT-TASK"/></locator></to>
136
+ </edge>
137
+ <edge id="TR-AVOID" type="satisfies">
138
+ <from><locator><local id="REQ-AVOID"/></locator></from>
139
+ <to><locator><local id="QGOAL-SAFETY"/></locator></to>
140
+ </edge>
141
+ <edge id="TR-AVOID-SCN" type="satisfies">
142
+ <from><locator><local id="REQ-AVOID"/></locator></from>
143
+ <to><locator><local id="SCN-OBST"/></locator></to>
144
+ </edge>
145
+ <edge id="TR-RISK" type="mitigates">
146
+ <from><locator><local id="REQ-AVOID"/></locator></from>
147
+ <to><locator><local id="RISK-COLLISION"/></locator></to>
148
+ </edge>
149
+ <edge id="TR-ASSIGN-TEST" type="verifiedBy">
150
+ <from><locator><local id="REQ-ASSIGN"/></locator></from>
151
+ <to><locator><local id="TC-ASSIGN"/></locator></to>
152
+ </edge>
153
+ <edge id="TR-AVOID-TEST" type="verifiedBy">
154
+ <from><locator><local id="REQ-AVOID"/></locator></from>
155
+ <to><locator><local id="TC-AVOID"/></locator></to>
156
+ </edge>
157
+ </trace>
158
+ </rqml>
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@rqml/schema",
3
+ "version": "0.1.0",
4
+ "description": "Canonical RQML XSD schemas (the single source of truth), example documents, and the AGENTS.md template, with a typed version resolver. Schema text is inlined for offline, bundler-friendly consumption.",
5
+ "type": "module",
6
+ "license": "Apache-2.0",
7
+ "author": "Gardar Gudgeirsson",
8
+ "keywords": [
9
+ "rqml",
10
+ "schema",
11
+ "xsd",
12
+ "requirements"
13
+ ],
14
+ "sideEffects": false,
15
+ "files": [
16
+ "dist",
17
+ "versions",
18
+ "examples",
19
+ "templates"
20
+ ],
21
+ "exports": {
22
+ ".": {
23
+ "types": "./dist/index.d.ts",
24
+ "import": "./dist/index.js"
25
+ },
26
+ "./versions/*": "./versions/*",
27
+ "./examples/*": "./examples/*",
28
+ "./templates/*": "./templates/*",
29
+ "./package.json": "./package.json"
30
+ },
31
+ "devDependencies": {
32
+ "@types/node": "^22.0.0",
33
+ "tsup": "^8.3.0",
34
+ "typescript": "^5.6.0",
35
+ "vitest": "^2.1.0"
36
+ },
37
+ "scripts": {
38
+ "build": "tsup",
39
+ "typecheck": "tsc --noEmit",
40
+ "test": "vitest run",
41
+ "dev": "vitest"
42
+ }
43
+ }
@@ -0,0 +1,109 @@
1
+ # RQML Agent Guidelines
2
+
3
+ ## Strictness: `standard`
4
+
5
+ | Level | Description |
6
+ |-------|-------------|
7
+ | `relaxed` | Prototyping. Spec is advisory. Quick iteration allowed. |
8
+ | `standard` | Production default. Spec-first for features. Core traces. |
9
+ | `strict` | Full traceability. All behavior specified. No ghost features. |
10
+ | `certified` | Regulated/safety-critical. Audit-grade traces with metadata. |
11
+
12
+ ---
13
+
14
+ This project uses **RQML** as the single source of truth for system intent. Familiarize yourself with the documentation at https://rqml.org/docs/user-guide/
15
+
16
+ **Specification file:** Specification lives in a single .rqml file in the root of the project - convention is `requirements.rqml`. Multiple .rqml files may be employed in multirepo projects, in such cases a .rqml spec applies to everything that is higher in the project tree, unless overridden by another .rqml file.
17
+
18
+ **Schema file:**
19
+ The RQML XSD schema is at https://rqml.org/schema/rqml-2.1.0.xsd (insert correct version number). Make sure to adhere to the schema at all times and follow guidelines in schema comments. Use as much of the RQML tagset as is necessary to capture and describe high quality requirements.
20
+
21
+ ---
22
+
23
+ ## Core Principle: Spec-First Development
24
+
25
+ ```
26
+ [Elicit] → [Specify] → [Implement] → [Verify] → [Trace]
27
+ ↑____________________←______________________|
28
+ ```
29
+
30
+ Code follows specification, not the reverse. If code and spec diverge, the spec is authoritative—update the code or negotiate a spec change with the developer.
31
+
32
+ ---
33
+
34
+ ## Workflow
35
+
36
+ ### 1. Elicit
37
+ Ask clarifying questions until you understand the goal, scope, acceptance criteria, and constraints. Don't assume—capture assumptions as `<notes>` or `<issue>` elements.
38
+
39
+ ### 2. Specify
40
+ **Never implement unspecified behavior.** Update the `.rqml` file before coding:
41
+ - Add a `<req>` with statement and acceptance criteria
42
+ - Set appropriate `type`, `priority`, and `status="draft"`
43
+ - Get developer confirmation before proceeding
44
+
45
+ ### 3. Implement
46
+ Reference requirement IDs in code comments. If you discover missing requirements, stop and add them to the spec first.
47
+
48
+ ### 4. Verify
49
+ Add tests that reference requirement IDs. Update `<trace>` section with verification links.
50
+
51
+ ---
52
+
53
+ ## When Code and Spec Diverge
54
+
55
+ 1. **Spec gap** (code has behavior not in spec): Propose adding the requirement, mark as `status="review"`
56
+ 2. **Code bug** (code doesn't match spec): Fix the code
57
+ 3. **Spec bug** (spec is wrong): Propose correction, wait for developer confirmation
58
+
59
+ **Never silently change the spec to match code.**
60
+
61
+ ---
62
+
63
+ ## Strictness Reference
64
+
65
+ | Aspect | relaxed | standard | strict | certified |
66
+ |--------|---------|----------|--------|-----------|
67
+ | Elicitation | Major features | Testable reqs | Edge cases | Formal |
68
+ | Spec-first | Recommended | Required | Required | Approved first |
69
+ | Code traces | Optional | New features | All changes | With metadata |
70
+ | Test traces | Optional | New reqs | All reqs | Full matrix |
71
+ | Ghost features | Allowed | Blocked | Blocked | Blocked |
72
+
73
+ ---
74
+
75
+ ## Change Summary Template
76
+
77
+ For PRs and commits:
78
+
79
+ ```
80
+ ## RQML Trace Summary
81
+
82
+ **Requirements:** REQ-xxx (added/modified/implemented)
83
+ **Implementation:** `path/to/file` — what changed
84
+ **Verification:** `path/to/test` — what it verifies
85
+ **Open items:** gaps, assumptions, follow-ups
86
+ ```
87
+
88
+ ---
89
+
90
+ ## Schema Validation
91
+
92
+ The `.rqml` file must remain valid XML conforming to the version of RQML referenced in the version attribute in the spec document.
93
+
94
+ **To validate:** Try xmllint first (pre-installed on macOS/Linux):
95
+ ```bash
96
+ xmllint --schema https://rqml.org/schema/rqml-2.1.0.xsd <rqml-file-name> --noout
97
+ ```
98
+
99
+ If xmllint is unavailable, use Python with lxml:
100
+ ```bash
101
+ pip install lxml
102
+ python -c "from lxml import etree; s=etree.XMLSchema(etree.parse('https://rqml.org/schema/rqml-2.1.0.xsd')); print('Valid' if s.validate(etree.parse('<rqml-file-name>')) else s.error_log)"
103
+ ```
104
+
105
+ **IDE validation:** If the `.rqml` file includes `xsi:schemaLocation`, XML-aware editors (VS Code with XML extension, IntelliJ) validate automatically.
106
+
107
+ The schema comments contain detailed guidance on document structure, ID conventions, and requirement quality criteria.
108
+
109
+ **If unsure:** Ask the developer before making structural changes to the spec.