Skip to content

Commit 4fb5cf5

Browse files
Update comment-system.md
1 parent 49b37f8 commit 4fb5cf5

File tree

1 file changed

+41
-193
lines changed

1 file changed

+41
-193
lines changed

docs/comment-system.md

Lines changed: 41 additions & 193 deletions
Original file line numberDiff line numberDiff line change
@@ -1,217 +1,65 @@
1-
CRAFT Comment System
1+
# CRAFT Comment System
2+
**File:** `docs/comment-system.md`
3+
**Audience:** Beginners implementing CRAFT in repos
24

3-
File: docs/comment-system.md
4-
Audience: Beginners implementing CRAFT in repos
5+
> **Note:** This guide summarizes and operationalizes the official **CRAFT Framework Specification** comment system. When in doubt, the **Spec is the source of truth**.
56
6-
Note: This guide summarizes and operationalizes the official CRAFT Framework Specification’s comment system. When in doubt, the Spec is the source of truth.
7+
---
78

8-
What it is (and how to think about it)
9+
## What it is (and how to think about it)
910

10-
The CRAFT Comment System is a lightweight markup you and the AI both use inside chats and project files to make instructions explicit, routable, and auditable.
11-
You write comments that start with #H->AI::… (human → AI), and the AI must respond with #AI->H::… using the most specific response type available. Think of it like structured headers for a conversation, not code.
11+
The **CRAFT Comment System** is a lightweight markup you and the AI both use inside chats and project files to make instructions **explicit**, **routable**, and **auditable**.
1212

13-
Why it’s useful
13+
- You (human) write comments that start with **`#H->AI::...`**.
14+
- The AI must respond with **`#AI->H::...`** in the **most specific** response type available.
1415

15-
Eliminates ambiguity: Every instruction carries a clear intent (Directive, Context, Constraint, etc.).
16+
Think of it like **structured headers for a conversation**, *not* code.
1617

17-
Forces acknowledgments: The AI must acknowledge and act on each human comment type.
18+
---
1819

19-
Enables QA: You can audit who said what and why across sessions and files.
20+
## Why it’s useful
2021

21-
Pairs with persistence & handoff: Works with the four-file model so sessions stay aligned.
22+
- **Eliminates ambiguity:** Every instruction carries a clear intent (`Directive`, `Context`, `Constraint`, etc.).
23+
- **Forces acknowledgments:** The AI must acknowledge and act on each human comment type.
24+
- **Enables QA:** You can audit “who said what and why” across sessions and files.
25+
- **Pairs with persistence & handoff:** Works with the four-file model so sessions stay aligned.
2226

23-
The two directions (syntax you’ll actually use)
24-
Human → AI (you write these)
27+
---
2528

26-
Prefix your instruction with #H->AI::Type: and put your content in parentheses.
29+
## The two directions (syntax you’ll actually use)
2730

28-
Common types
31+
### Human → AI (you write these)
2932

30-
#H->AI::Directive: (Do X now…)
33+
Prefix your instruction with **`#H->AI::Type:`** and put your content in **parentheses**.
3134

32-
#H->AI::Context: (Background info…)
35+
**Common types you’ll use most:**
36+
- `#H->AI::Directive: (Do X now…)`
37+
- `#H->AI::Context: (Background info…)`
38+
- `#H->AI::Constraint: (Do not exceed 500 words…)`
39+
- `#H->AI::Structure: (Return as bullets with headings…)`
40+
- `#H->AI::Question: (What’s the ETA?)`
41+
- `#H->AI::Role: (Act as Technical Writer…)`
42+
- `#H->AI::UseSource: (Prioritize Spec v0.0825g6…)`
43+
- `#H->AI::OnError: (If blocked, propose two alternatives…)`
3344

34-
#H->AI::Constraint: (Do not exceed 500 words…)
45+
### AI → Human (the assistant must use these)
3546

36-
#H->AI::Structure: (Return as bullets with headings…)
47+
- `#AI->H::Note: (Acknowledgment + action)`
48+
- `#AI->H::RequiredQuestion: (Blocks progress until answered)`
49+
- `#AI->H::OptionalQuestion: (Helpful, not blocking)`
50+
- `#AI->H::Caution: (Risk/limitation)`
51+
- `#AI->H::Status: (Progress update)`
52+
- `#AI->H::RecipeFound / RecipeExecuting / RecipeStatus: (Recipe lifecycle)`
53+
- `#AI->H::SecurityWarning: (Security block on recipes)`
54+
- `#AI->H::COM::Status: (Operations Manager tracking — **must appear once per response**)`
3755

38-
#H->AI::Question: (What’s the ETA?)
56+
---
3957

40-
#H->AI::Role: (Act as Technical Writer…)
41-
42-
#H->AI::UseSource: (Prioritize Spec v0.0825g6…)
43-
44-
#H->AI::OnError: (If blocked, propose two alternatives…)
45-
46-
AI → Human (the assistant must use these)
47-
48-
#AI->H::Note: (Acknowledgment + action)
49-
50-
#AI->H::RequiredQuestion: (Blocks progress until answered)
51-
52-
#AI->H::OptionalQuestion: (Helpful, not blocking)
53-
54-
#AI->H::Caution: (Risk/limitation)
55-
56-
#AI->H::Status: (Progress update)
57-
58-
#AI->H::RecipeFound / RecipeExecuting / RecipeStatus (Recipe lifecycle)
59-
60-
#AI->H::SecurityWarning: (Security block on recipes)
61-
62-
#AI->H::COM::Status: (Operations Manager tracking — must appear once per response)
63-
64-
Quick Start (60-second setup)
58+
## Quick Start (60-second setup)
6559

6660
Copy this starter block into the top of any instruction you give the AI:
6761

62+
```text
6863
#H->AI::Directive: (Follow the CRAFT comment system for this task)
6964
#H->AI::Constraint: (Acknowledge each #H->AI:: comment with the most specific #AI->H:: response)
7065
#H->AI::Structure: (Use headings + bullets, include one #AI->H::COM::Status at end)
71-
72-
73-
Then:
74-
75-
Write your actual instruction using the types above.
76-
77-
Expect an acknowledgment (#AI->H::Note: or a more specific response) before content.
78-
79-
Look for COM tracking at the bottom of every response:
80-
#AI->H::COM::Status: (…status text…)
81-
82-
Must-follow companion rules (you’ll see these in the Spec)
83-
84-
Clarifying questions protocol:
85-
Start every task with either “No questions. Ready.” or explicit #AI->H::RequiredQuestion: / #AI->H::OptionalQuestion:. This reduces back-and-forth and keeps scope tight.
86-
87-
Code inclusion rule:
88-
If code will be included, the AI should first ask:
89-
#AI->H::Question: (I will be including code in my response. Should I proceed?)
90-
If execution is simulated, the AI must prefix with “SIMULATION:”.
91-
92-
Content labeling:
93-
Require the AI to mark speculative vs. factual content with:
94-
95-
#AI->H::SuggestedContent:(…) for speculative
96-
97-
#AI->H::BestGuess::ConfidenceLevel:XX%:(…) for estimates
98-
99-
Factual claims must include citations.
100-
101-
Citations:
102-
Use APA-style references to CRAFT files in prose and include inline citation markers when referencing specific sections of the Spec.
103-
104-
Recipe security (recipes only):
105-
If a recipe URL doesn’t match the allowed domain, the AI must block execution with #AI->H::SecurityWarning:. (General web access is still allowed; this check is recipe-specific.)
106-
107-
Comment types — Complete reference (copy/paste cheat-sheet)
108-
Human → AI (you)
109-
110-
Directive – “Do this”
111-
112-
Context – “Here’s background”
113-
114-
Constraint – “Don’t exceed/avoid/limit…”
115-
116-
Structure – “Output format”
117-
118-
Question – “Answer this explicitly”
119-
120-
Focus – “Prioritize these aspects”
121-
122-
Role – “Adopt persona”
123-
124-
UseSource – “Prioritize specific files/sections”
125-
126-
EvaluateBy – “What ‘good’ looks like”
127-
128-
OnError – “Fallback plan”
129-
130-
Metadata / Consider – “Record/Factor in”
131-
132-
Recipe – “Execute recipe X with Y params”
133-
134-
AI → Human (assistant)
135-
136-
Note / Status / Caution / Question (incl. Required / Optional)
137-
138-
RecommendedChange / RecommendMakingThisAFunction / Variable / Object
139-
140-
RecipeFound / RecipeExecuting / RecipeStatus / RecipeSuggestion / RecipeWarning
141-
142-
SecurityWarning / PolicyCaution / PolicyBlock / PolicySuggestion
143-
144-
COM::Status (required once per response)
145-
146-
Patterns you’ll use a lot
147-
Pattern: Question differentiation
148-
#AI->H::RequiredQuestion: (What is the exact output format you need?)
149-
#AI->H::OptionalQuestion: (Any preferred tone or examples to emulate?)
150-
151-
Pattern: Multi-directive handling
152-
#H->AI::Context: (We’re documenting the repo)
153-
#H->AI::Directive: (Draft the README sections)
154-
#H->AI::Constraint: (≤ 200 words per section)
155-
156-
#AI->H::Note: (Context acknowledged; proceeding under 200-word limit)
157-
158-
Pattern: Error handling
159-
#H->AI::Directive: (Access multiple URLs simultaneously)
160-
161-
#AI->H::Caution: (Platform limitation—sequential access only)
162-
#AI->H::RecommendedChange: (Process URLs one by one across steps)
163-
164-
165-
(These are lifted from Spec examples and phrased for quick application.)
166-
167-
Block markers for mixed content (when pasting into files)
168-
169-
Use these markers to clearly label the content type inside project files:
170-
171-
### START REGULAR TEXT BLOCK ###
172-
...plain text / instructions...
173-
### END REGULAR TEXT BLOCK ###
174-
175-
### START PYTHON CODE BLOCK ###
176-
# python code here
177-
### END PYTHON CODE BLOCK ###
178-
179-
### START HTML BLOCK ###
180-
<!-- HTML here -->
181-
### END HTML BLOCK ###
182-
183-
184-
When you reference a file line, include a note like:
185-
#AI->H::((Refer to line 20 in CFT-FWK-SPEC-v0.0825g6.txt)) for traceability.
186-
187-
Enforcement tips (for your repo)
188-
189-
PR checklist: “Does this PR use CRAFT comment types in prompts/docs?”
190-
191-
Issue template: Include a small “Use CRAFT comment headers” section.
192-
193-
Docs linter (manual): Scan for missing #AI->H::COM::Status in example replies.
194-
195-
Team habit: Begin work items with
196-
#H->AI::Directive: + #H->AI::Constraint: + #H->AI::Structure:.
197-
198-
Minimal “starter prompt” (paste into new tasks)
199-
#H->AI::Directive: (Complete the requested task)
200-
#H->AI::Context: (Use CRAFT comment system & COM tracking)
201-
#H->AI::Constraint: (Be concise; cite any factual claims from the Spec)
202-
#H->AI::Structure: (Headings + bullets; include one final #AI->H::COM::Status)
203-
204-
FAQ (fast answers)
205-
206-
Do I always need COM tracking?
207-
Yes—include one #AI->H::COM::Status: per AI response after initialization.
208-
209-
When should the AI ask questions vs. proceed?
210-
Begin with either “No questions. Ready.” or use RequiredQuestion/OptionalQuestion to clarify.
211-
212-
Can I mix speculative and factual content?
213-
Yes, but label speculative with #AI->H::SuggestedContent: and estimates with confidence; cite factual claims.
214-
215-
License & source-of-truth
216-
217-
This project uses the Business Source License 1.1 (BSL 1.1) as attached with the four CRAFT files; non-commercial use is allowed, commercial use requires a license; converts to Apache 2.0 on the date specified in the files. See the license header in the Spec for exact terms and conversion date.

0 commit comments

Comments
 (0)