Add context packs impact analysis and message validation
This commit is contained in:
@@ -13,8 +13,10 @@ README 面向准备使用 GSP 语言的人类和 AI。它说明 GSP 的用途、
|
||||
| `README.md` | GSP 语言使用前说明。给人类和 AI 阅读。 |
|
||||
| `gsp.schema.json` | GSP 第一版核心字段规范。使用 JSON Schema 表达,便于 AI、工具、编译器和实现模块识别。 |
|
||||
| `gsp.manifest.schema.json` | GSP 工程 manifest 字段规范。 |
|
||||
| `gsp.message.schema.json` | GSP agent 通信消息字段规范。 |
|
||||
| `commands.md` | GSP Toolkit 命令规范。 |
|
||||
| `ai-usage.md` | GSP 项目 AI 使用规则。 |
|
||||
| `message.md` | GSP Message 说明。 |
|
||||
|
||||
## GSP 是什么
|
||||
|
||||
|
||||
@@ -16,4 +16,6 @@
|
||||
- Use `gsp trace <id>` to inspect relations.
|
||||
- Use `gsp flatten <id>` before implementation or task splitting.
|
||||
- Use `gsp pack <id>` when a compact AI context is needed.
|
||||
- Use `gsp impact <id>` before changing shared GSP units.
|
||||
- Use `gsp message validate <file>` for agent communication messages.
|
||||
- Use `gsp stage-check --stage <stage>` before stage handoff.
|
||||
|
||||
@@ -100,9 +100,55 @@ gsp flatten <id> [--root .] [--depth 3] [--include-type a,b] [--exclude-type a,b
|
||||
Create a compact AI context pack.
|
||||
|
||||
```bash
|
||||
gsp pack <id> [--root .] [--depth 3] [--budget 12000] [--out context-pack.json]
|
||||
gsp pack <id> [--root .] [--for implement] [--stage implement] [--depth 3] [--budget 12000] [--format json|md|canvas] [--out context-pack.json]
|
||||
```
|
||||
|
||||
The `--for` value describes the task intent:
|
||||
|
||||
```text
|
||||
design
|
||||
implement
|
||||
review
|
||||
test
|
||||
acceptance
|
||||
handoff
|
||||
inspect
|
||||
```
|
||||
|
||||
Formats:
|
||||
|
||||
```text
|
||||
json Machine-readable context pack.
|
||||
md Human-readable and AI-readable context pack.
|
||||
canvas Obsidian JSON Canvas for included GSP relations.
|
||||
```
|
||||
|
||||
## impact
|
||||
|
||||
Find direct and indirect GSPs affected by a GSP id.
|
||||
|
||||
```bash
|
||||
gsp impact <id> [--root .] [--depth -1] [--format json|md|canvas] [--out impact.json]
|
||||
```
|
||||
|
||||
Formats:
|
||||
|
||||
```text
|
||||
json Machine-readable impact result.
|
||||
md Human-readable impact report.
|
||||
canvas Obsidian JSON Canvas for affected relations.
|
||||
```
|
||||
|
||||
## message
|
||||
|
||||
Validate GSP agent communication messages.
|
||||
|
||||
```bash
|
||||
gsp message validate <file> [--root .] [--out message-report.json]
|
||||
```
|
||||
|
||||
Message files use YAML and reference GSP ids from the project.
|
||||
|
||||
## graph
|
||||
|
||||
Generate a relation graph.
|
||||
|
||||
63
specs/versions/0.1/gsp.message.schema.json
Normal file
63
specs/versions/0.1/gsp.message.schema.json
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://gsp.local/schema/gsp.message.schema.json",
|
||||
"title": "GSP Message",
|
||||
"description": "GSP agent communication message schema.",
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"required": ["gspMessageVersion", "id", "from", "to", "intent", "entry"],
|
||||
"properties": {
|
||||
"gspMessageVersion": {
|
||||
"type": "string",
|
||||
"enum": ["0.1"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"from": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"to": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"intent": {
|
||||
"type": "string",
|
||||
"enum": ["design", "implement", "review", "test", "acceptance", "handoff", "inspect"]
|
||||
},
|
||||
"entry": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"stage": {
|
||||
"type": "string",
|
||||
"enum": ["design", "integrate", "implement", "bind", "release"]
|
||||
},
|
||||
"requires": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
},
|
||||
"contextPack": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"mode": {
|
||||
"type": "string",
|
||||
"enum": ["design", "implement", "review", "test", "acceptance", "handoff", "inspect"]
|
||||
},
|
||||
"depth": {
|
||||
"type": "integer"
|
||||
},
|
||||
"budget": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
41
specs/versions/0.1/message.md
Normal file
41
specs/versions/0.1/message.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# GSP Message 0.1
|
||||
|
||||
GSP Message is a lightweight agent communication format.
|
||||
|
||||
It references GSP ids and does not replace `.gsp` files.
|
||||
|
||||
```yaml
|
||||
gspMessageVersion: 0.1
|
||||
id: msg.implement.lottery_page
|
||||
from: planner
|
||||
to: implementer
|
||||
intent: implement
|
||||
entry: page.lottery.main
|
||||
stage: implement
|
||||
requires:
|
||||
- ui.button.reward_primary
|
||||
- feedback.positive
|
||||
contextPack:
|
||||
mode: implement
|
||||
depth: -1
|
||||
budget: 12000
|
||||
```
|
||||
|
||||
Required fields:
|
||||
|
||||
| Field | Meaning |
|
||||
|---|---|
|
||||
| `gspMessageVersion` | Message protocol version. |
|
||||
| `id` | Message id. |
|
||||
| `from` | Sender agent or module id. |
|
||||
| `to` | Receiver agent or module id. |
|
||||
| `intent` | Task intent. |
|
||||
| `entry` | Entry GSP id. |
|
||||
|
||||
Validation:
|
||||
|
||||
```bash
|
||||
gsp message validate message.gspmsg --root .
|
||||
```
|
||||
|
||||
The validator checks message version, required fields, intent, stage, entry GSP, and required GSP references.
|
||||
Reference in New Issue
Block a user