@voodocs/cli 2.5.2 → 3.0.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.
@@ -1,15 +1,15 @@
1
1
  """@darkarts
2
- ⊢ai-instructions:ctx.templates
2
+ {ai-instructions:ctx.templates}
3
3
  ∂{typing}
4
- ⚠{ai:cursor∨claude,project:voodocs-enabled,templates:markdown}
5
- ⊨{∀gen→valid-markdown,∀gen→include-cmds,∀gen→teach-best-practices}
4
+ ⚠{ai:cursor∨claude,project:darkarts-enabled,templates:markdown}
5
+ ⊨{∀gen→valid-markdown,∀gen→include-cmds,∀gen→teach-v3-notation}
6
6
  🔒{no-implications}
7
7
  ⚡{O(1)|template-generation}
8
8
 
9
- AI instruction templates for VooDocs Context System.
9
+ AI instruction templates for DarkArts v3.0.0 Context System.
10
10
 
11
11
  This module provides templates for generating AI assistant instructions
12
- that teach them how to use the VooDocs context system effectively.
12
+ that teach them how to use the DarkArts mathematical notation system.
13
13
  """
14
14
 
15
15
  from typing import Dict, Optional
@@ -17,7 +17,7 @@ from typing import Dict, Optional
17
17
 
18
18
  def generate_cursorrules(project_name: str, project_purpose: str) -> str:
19
19
  """
20
- Generate .cursorrules content for Cursor AI.
20
+ Generate .cursorrules content for Cursor AI with DarkArts v3.0.0.
21
21
 
22
22
  Args:
23
23
  project_name: Name of the project
@@ -26,716 +26,530 @@ def generate_cursorrules(project_name: str, project_purpose: str) -> str:
26
26
  Returns:
27
27
  Content for .cursorrules file
28
28
  """
29
- return f"""# {project_name} - VooDocs Context System
29
+ return f"""# {project_name} - DarkArts v3.0.0
30
30
 
31
31
  ## Project Overview
32
32
  {project_purpose}
33
33
 
34
- ## VooDocs Context System (v0.2.0+)
34
+ ## DarkArts v3.0.0 - AI-Native Mathematical Documentation
35
35
 
36
- This project uses VooDocs with the Context System for intelligent documentation and validation.
36
+ This project uses **DarkArts v3.0.0**, an AI-native mathematical notation system for code documentation.
37
37
 
38
- ### Context File Location
39
- - **Context file**: `.voodocs.context` (YAML format)
40
- - **Auto-generated**: From @voodocs annotations in code
41
- - **Version controlled**: Track context changes over time
38
+ **Key Philosophy**: DarkArts is **for AI, not humans**. It uses mathematical symbols for maximum token efficiency and AI comprehension.
42
39
 
43
- ### Essential Commands
40
+ ---
44
41
 
45
- #### Before Starting Work
46
- ```bash
47
- # Read the project context to understand architecture, invariants, and assumptions
48
- voodocs context view
49
- ```
42
+ ## Mathematical Notation Reference
43
+
44
+ ### Core Symbols
45
+
46
+ | Symbol | Meaning | Example |
47
+ |--------|---------|---------|
48
+ | `⊢` | Purpose | `⊢{{u auth svc w/ JWT tok gen}}` |
49
+ | `∂` | Dependencies | `∂{{bcrypt,jsonwebtoken,db}}` |
50
+ | `⚠` | Assumptions | `⚠{{db conn established,u authenticated}}` |
51
+ | `⊳` | Preconditions | `⊳{{id:uuid,pw≥8}}` |
52
+ | `⊲` | Postconditions | `⊲{{ret JWT tok|null}}` |
53
+ | `⊨` | Invariants | `⊨{{no db mod,no pw log}}` |
54
+ | `⚡` | Complexity | `⚡{{O(n)|linear-search}}` |
55
+ | `🔒` | Security | `🔒{{pw:hash,tok:enc}}` |
56
+
57
+ ### New Symbols (v3.0.0)
58
+
59
+ | Symbol | Meaning | Example |
60
+ |--------|---------|---------|
61
+ | `⇄` | Bidirectional | `⇄{{enc↔dec,compress↔decompress}}` |
62
+ | `⊕` | Side Effects | `⊕{{writes db,sends email,logs event}}` |
63
+ | `⊗` | Forbidden | `⊗{{no pw log,no api key exposure}}` |
64
+ | `≈` | Approximation | `≈{{±0.001,~100ms}}` |
65
+ | `∴` | Consequence | `∴{{fail→null,invalid→err}}` |
66
+ | `∀` | Universal | `∀{{users have email,ids are unique}}` |
67
+ | `∃` | Existential | `∃{{admin required,config file exists}}` |
50
68
 
51
- #### During Development
52
- ```bash
53
- # Add @voodocs annotations to your code (see format below)
54
- # Then auto-generate context from annotations
55
- voodocs context generate --update
69
+ ---
56
70
 
57
- # Check if code respects documented invariants
58
- voodocs context check
71
+ ## Pattern Shortcuts (v3.0.0)
59
72
 
60
- # Query specific information
61
- voodocs context query "search term" --section invariants
62
- ```
73
+ ### Type Patterns
63
74
 
64
- #### Before Committing
65
- ```bash
66
- # Validate context and check invariants
67
- voodocs context validate --check-invariants
75
+ Use `:pattern` for common validations:
68
76
 
69
- # Update context version with description
70
- voodocs context update --description "Brief description of changes"
71
- ```
77
+ | Pattern | Meaning | Example |
78
+ |---------|---------|---------|
79
+ | `:uuid` | Valid UUID | `id:uuid` |
80
+ | `:email` | Valid email | `email:email` |
81
+ | `:url` | Valid URL | `url:url` |
82
+ | `:json` | Valid JSON | `data:json` |
83
+ | `:jwt` | Valid JWT | `tok:jwt` |
84
+ | `:hash` | Hash format | `pw:hash` |
85
+ | `:enc` | Encrypted | `data:enc` |
72
86
 
73
- #### Architecture & Documentation
74
- ```bash
75
- # Generate architecture diagrams
76
- voodocs context diagram --type modules --output docs/architecture.mmd
87
+ ### Numeric Patterns
77
88
 
78
- # View full context as Markdown
79
- voodocs context view > docs/CONTEXT.md
80
- ```
89
+ | Pattern | Meaning | Example |
90
+ |---------|---------|---------|
91
+ | `≥N` | Greater or equal | `pw≥8` |
92
+ | `≤N` | Less or equal | `age≤120` |
93
+ | `>N` | Greater than | `score>0` |
94
+ | `<N` | Less than | `retry<5` |
95
+ | `[N,M]` | Range | `age[18,65]` |
96
+ | `∈{{...}}` | Set membership | `status∈{{active,pending}}` |
81
97
 
82
- ### @voodocs Annotation Format
98
+ ---
83
99
 
84
- Add to Python/TypeScript/JavaScript files:
100
+ ## Enhanced Abbreviations (v3.0.0)
101
+
102
+ ### Core Terms
103
+
104
+ | Abbrev | Full | Abbrev | Full |
105
+ |--------|------|--------|------|
106
+ | `u` | user | `pw` | password |
107
+ | `auth` | authentication | `tok` | token |
108
+ | `svc` | service | `db` | database |
109
+ | `req` | request | `res` | response |
110
+ | `ret` | return | `err` | error |
111
+ | `val` | validate | `gen` | generate |
112
+ | `proc` | process | `exec` | execute |
113
+ | `cfg` | config | `env` | environment |
114
+
115
+ ### Web/API Terms
116
+
117
+ | Abbrev | Full | Abbrev | Full |
118
+ |--------|------|--------|------|
119
+ | `ep` | endpoint | `rt` | route |
120
+ | `mw` | middleware | `hdlr` | handler |
121
+ | `ctrl` | controller | `mdl` | model |
122
+ | `svc` | service | `repo` | repository |
123
+ | `dto` | data transfer object | `api` | API |
124
+
125
+ ### Security Terms
126
+
127
+ | Abbrev | Full | Abbrev | Full |
128
+ |--------|------|--------|------|
129
+ | `enc` | encryption | `dec` | decryption |
130
+ | `hash` | hashing | `sig` | signature |
131
+ | `cert` | certificate | `perm` | permission |
132
+ | `role` | role | `sess` | session |
133
+
134
+ ### Data Terms
135
+
136
+ | Abbrev | Full | Abbrev | Full |
137
+ |--------|------|--------|------|
138
+ | `tbl` | table | `col` | column |
139
+ | `rec` | record | `idx` | index |
140
+ | `pk` | primary key | `fk` | foreign key |
141
+ | `qry` | query | `txn` | transaction |
85
142
 
86
- **Python:**
87
- ```python
88
- \"\"\"@voodocs
89
- module_purpose: "Brief description of what this module does"
90
- dependencies: [
91
- "other-module: What it provides",
92
- "external-lib: Why we use it"
93
- ]
94
- assumptions: [
95
- "Database connection is established",
96
- "User is authenticated",
97
- "Environment variables are set"
98
- ]
99
- invariants: [
100
- "All user input must be validated",
101
- "Passwords must be hashed before storage",
102
- "API keys must never be logged"
103
- ]
104
- security_model: "Brief description of security approach"
105
- performance_notes: "Expected performance characteristics"
106
- \"\"\"
107
- ```
143
+ ---
144
+
145
+ ## Complete Example
108
146
 
109
147
  **TypeScript/JavaScript:**
110
148
  ```typescript
111
- /**@voodocs
112
- module_purpose: "Brief description of what this module does"
113
- dependencies: [
114
- "react: UI framework",
115
- "axios: HTTP client"
116
- ]
117
- assumptions: [
118
- "API endpoint is available",
119
- "User has valid token"
120
- ]
121
- invariants: [
122
- "All API responses must be validated",
123
- "Errors must be handled gracefully"
124
- ]
149
+ /**@darkarts
150
+ ⊢{{u auth svc w/ JWT tok gen}}
151
+ ∂{{bcrypt,jsonwebtoken,db}}
152
+ ⚠{{db conn established,u tbl exists}}
153
+ ⊳{{email:email,pw≥8}}
154
+ ⊲{{ret JWT tok|null}}
155
+ ⊨{{no pw log,no db mod}}
156
+ ⊕{{logs auth attempt,updates last_login}}
157
+ ⊗{{no pw in logs,no tok in logs}}
158
+ 🔒{{pw:hash,tok:enc,sess:secure}}
159
+ ⚡{{O(1)|hash-lookup}}
160
+ ⇄{{login↔logout}}
161
+ ∴{{invalid→null,expired→refresh}}
162
+ ∀{{users have unique email}}
163
+ ∃{{admin role required for setup}}
164
+ ≈{{~50ms response time}}
125
165
  */
166
+ async function authenticateUser(email, password) {{
167
+ // Implementation
168
+ }}
126
169
  ```
127
170
 
128
- ### Context-Aware Development Workflow
129
-
130
- 1. **Understand Context**: Always run `voodocs context view` before making changes
131
- 2. **Check Invariants**: Ensure you understand the global invariants that must be respected
132
- 3. **Add Annotations**: Document your code with @voodocs annotations as you write
133
- 4. **Update Context**: Run `voodocs context generate --update` after adding features
134
- 5. **Validate**: Run `voodocs context check` to ensure invariants are respected
135
- 6. **Update Version**: Use `voodocs context update` to track context changes
136
-
137
- ### What to Document
138
-
139
- **Module Purpose**: What this module does and why it exists
140
- **Dependencies**: What this module depends on (internal and external)
141
- **Assumptions**: What must be true for this module to work correctly
142
- **Invariants**: Rules that must always hold (security, data integrity, etc.)
143
- **Security Model**: How this module handles security concerns
144
- **Performance Notes**: Expected performance characteristics and bottlenecks
145
-
146
- ### Context Sections
147
-
148
- The `.voodocs.context` file contains:
149
-
150
- - **Project**: Name, purpose, domain
151
- - **Versioning**: Code version, context version, last updated
152
- - **Invariants**: Global rules that must always hold
153
- - **Assumptions**: System-wide assumptions
154
- - **Architecture**: Modules, decisions, patterns
155
- - **Critical Paths**: Important workflows
156
- - **Dependencies**: External libraries and tools
157
- - **Known Issues**: Bugs and limitations
158
- - **Change History**: Version tracking with Git integration
171
+ **Python:**
172
+ ```python
173
+ \"\"\"@darkarts
174
+ ⊢{{u auth svc w/ JWT tok gen}}
175
+ ∂{{bcrypt,jsonwebtoken,db}}
176
+ ⚠{{db conn established,u tbl exists}}
177
+ ⊳{{email:email,pw≥8}}
178
+ ⊲{{ret JWT tok|None}}
179
+ ⊨{{no pw log,no db mod}}
180
+ ⊕{{logs auth attempt,updates last_login}}
181
+ ⊗{{no pw in logs,no tok in logs}}
182
+ 🔒{{pw:hash,tok:enc,sess:secure}}
183
+ ⚡{{O(1)|hash-lookup}}
184
+ ⇄{{login↔logout}}
185
+ ∴{{invalid→None,expired→refresh}}
186
+ ∀{{users have unique email}}
187
+ ∃{{admin role required for setup}}
188
+ ≈{{~50ms response time}}
189
+ \"\"\"
190
+ async def authenticate_user(email: str, password: str):
191
+ # Implementation
192
+ pass
193
+ ```
159
194
 
160
- ### Best Practices
195
+ ---
161
196
 
162
- 1. **Read context first**: Always check context before making changes
163
- 2. **Document as you code**: Add @voodocs annotations while writing code
164
- 3. **Keep invariants clear**: Make invariants specific and testable
165
- 4. **Update regularly**: Run `voodocs context generate --update` frequently
166
- 5. **Validate before commit**: Run `voodocs context check` before committing
167
- 6. **Track changes**: Use `voodocs context update` to document what changed
197
+ ## Token Efficiency
168
198
 
169
- ### CI/CD Integration
199
+ **Traditional comment:** 140 tokens
200
+ **DarkArts v3.0.0:** 30 tokens
201
+ **Reduction:** 79% 🎯
170
202
 
171
- The context system can be integrated into CI/CD pipelines:
203
+ ---
172
204
 
173
- ```yaml
174
- # GitHub Actions example
175
- - name: Validate Context
176
- run: voodocs context validate --check-invariants
205
+ ## Context System Commands
177
206
 
178
- - name: Check Invariants
179
- run: voodocs context check --format json
207
+ ### Before Starting Work
208
+ ```bash
209
+ # Read project context to understand architecture
210
+ voodocs context view
180
211
  ```
181
212
 
182
- ### Querying Context
213
+ ### During Development
214
+ ```bash
215
+ # Add @darkarts annotations to your code
216
+ # Then update context from annotations
217
+ voodocs context generate --update
183
218
 
184
- Search for specific information:
219
+ # Check if code respects invariants
220
+ voodocs context check
221
+ ```
185
222
 
223
+ ### Before Committing
186
224
  ```bash
187
- # Find security-related invariants
188
- voodocs context query "security" --section invariants
189
-
190
- # Find authentication assumptions
191
- voodocs context query "auth" --section assumptions --format json
225
+ # Validate context and check invariants
226
+ voodocs context validate --check-invariants
192
227
 
193
- # Search all sections
194
- voodocs context query "database"
228
+ # Update context version
229
+ voodocs context update --description "Brief description of changes"
195
230
  ```
196
231
 
197
- ### Architecture Diagrams
232
+ ---
198
233
 
199
- Generate visual documentation:
234
+ ## Best Practices
200
235
 
201
- ```bash
202
- # Module dependency diagram
203
- voodocs context diagram --type modules
236
+ 1. **Use mathematical notation** - It's for AI, not humans
237
+ 2. **Use pattern shortcuts** - `:uuid`, `≥8`, etc.
238
+ 3. **Use abbreviations** - `u`, `auth`, `svc`, etc.
239
+ 4. **Be concise** - Maximum token efficiency
240
+ 5. **Be precise** - Mathematical symbols have exact meanings
241
+ 6. **Document invariants** - Rules that must always hold
242
+ 7. **Document side effects** - What changes state
243
+ 8. **Document forbidden operations** - What must never happen
204
244
 
205
- # External dependencies
206
- voodocs context diagram --type dependencies
245
+ ---
207
246
 
208
- # Critical path workflows
209
- voodocs context diagram --type flow
247
+ ## What to Document
210
248
 
211
- # Generate all diagrams
212
- voodocs context diagram --type all --output docs/arch
213
- ```
249
+ **Purpose (`⊢`)**: What this function/module does
250
+ **Dependencies (`∂`)**: What it depends on
251
+ **Assumptions (`⚠`)**: What must be true
252
+ **Preconditions (`⊳`)**: Input requirements
253
+ **Postconditions (`⊲`)**: Output guarantees
254
+ **Invariants (`⊨`)**: Rules that always hold
255
+ **Side Effects (`⊕`)**: What it modifies
256
+ **Forbidden (`⊗`)**: What it must not do
257
+ **Security (`🔒`)**: Security measures
258
+ **Complexity (`⚡`)**: Time/space complexity
214
259
 
215
- ### Remember
260
+ ---
216
261
 
217
- - The context system is your source of truth for project understanding
218
- - Invariants are enforced rules - respect them
219
- - Assumptions are documented expectations - validate them
220
- - Context is version-controlled - track changes
221
- - Always check context before making architectural decisions
262
+ ## Remember
263
+
264
+ - **DarkArts is for AI, not humans** - Use mathematical notation
265
+ - **79% token reduction** - Massive efficiency gains
266
+ - **Pattern shortcuts** - Use `:uuid`, `≥8`, etc.
267
+ - **Enhanced abbreviations** - 200+ terms available
268
+ - **New symbols** - ⇄, ⊕, ⊗, ≈, ∴, ∀, ∃
222
269
 
223
270
  ---
224
271
 
225
- **VooDocs Context System** - AI-native documentation that keeps code and context in sync.
272
+ **DarkArts v3.0.0** - The AI-Native Mathematical Language for Code
273
+
274
+ *Designed by AI, for AI.*
226
275
  """
227
276
 
228
277
 
229
- def generate_context_guide(project_name: str, project_purpose: str) -> str:
278
+ def generate_claude_instructions(project_name: str, project_purpose: str) -> str:
230
279
  """
231
- Generate comprehensive context guide for AI assistants.
280
+ Generate instructions for Claude AI with DarkArts v3.0.0.
232
281
 
233
282
  Args:
234
283
  project_name: Name of the project
235
284
  project_purpose: Brief purpose of the project
236
285
 
237
286
  Returns:
238
- Content for VOODOCS_CONTEXT_GUIDE.md file
287
+ Instructions for Claude
239
288
  """
240
- return f"""# VooDocs Context System Guide - {project_name}
289
+ return f"""# DarkArts v3.0.0 Instructions for Claude
241
290
 
242
- ## Project Overview
243
-
244
- **Name**: {project_name}
291
+ ## Project: {project_name}
245
292
  **Purpose**: {project_purpose}
246
293
 
247
- This project uses the **VooDocs Context System** (v0.2.0+) for intelligent documentation, validation, and architecture management.
248
-
249
294
  ---
250
295
 
251
- ## What is the Context System?
296
+ ## Your Role
252
297
 
253
- The VooDocs Context System is an AI-native documentation framework that:
298
+ You are working on a codebase that uses **DarkArts v3.0.0**, an AI-native mathematical notation system for code documentation.
254
299
 
255
- 1. **Auto-generates** project context from code annotations
256
- 2. **Validates** code against documented invariants
257
- 3. **Tracks** changes with version control integration
258
- 4. **Visualizes** architecture with auto-generated diagrams
259
- 5. **Queries** like a database for instant information
300
+ **Key Principle**: DarkArts is designed **for AI, not humans**. Use mathematical symbols for maximum token efficiency and precision.
260
301
 
261
302
  ---
262
303
 
263
- ## Quick Start
264
-
265
- ### 1. View Current Context
266
-
267
- ```bash
268
- voodocs context view
269
- ```
304
+ ## Core Symbols You Must Use
270
305
 
271
- This shows you:
272
- - Project purpose and domain
273
- - Global invariants (rules that must hold)
274
- - System assumptions
275
- - Architecture and modules
276
- - Dependencies
277
- - Known issues
306
+ When documenting code, use these mathematical symbols:
278
307
 
279
- **Do this before making any changes!**
308
+ - `⊢{{...}}` - Purpose (what this does)
309
+ - `∂{{...}}` - Dependencies (what it needs)
310
+ - `⚠{{...}}` - Assumptions (what must be true)
311
+ - `⊳{{...}}` - Preconditions (input requirements)
312
+ - `⊲{{...}}` - Postconditions (output guarantees)
313
+ - `⊨{{...}}` - Invariants (rules that always hold)
314
+ - `⚡{{...}}` - Complexity (time/space)
315
+ - `🔒{{...}}` - Security (security measures)
280
316
 
281
- ### 2. Check Invariants
317
+ **New in v3.0.0:**
318
+ - `⇄{{...}}` - Bidirectional relationships
319
+ - `⊕{{...}}` - Side effects (state modifications)
320
+ - `⊗{{...}}` - Forbidden operations (must not do)
321
+ - `≈{{...}}` - Approximations (acceptable error)
322
+ - `∴{{...}}` - Consequences (logical implications)
323
+ - `∀{{...}}` - Universal properties (for all)
324
+ - `∃{{...}}` - Existential properties (must exist)
282
325
 
283
- ```bash
284
- voodocs context check
285
- ```
326
+ ---
286
327
 
287
- This validates that the code respects all documented invariants:
288
- - Password hashing
289
- - API key protection
290
- - SQL injection prevention
291
- - Input validation
292
- - Error handling
293
- - And more...
328
+ ## Pattern Shortcuts
294
329
 
295
- ### 3. Update Context
330
+ Use these shortcuts for common validations:
296
331
 
297
- ```bash
298
- voodocs context generate --update
299
- ```
332
+ **Type patterns:**
333
+ - `id:uuid` - Valid UUID
334
+ - `email:email` - Valid email
335
+ - `url:url` - Valid URL
336
+ - `data:json` - Valid JSON
337
+ - `tok:jwt` - Valid JWT token
338
+ - `pw:hash` - Hashed password
339
+ - `data:enc` - Encrypted data
300
340
 
301
- This scans the codebase for @voodocs annotations and updates the context file.
341
+ **Numeric patterns:**
342
+ - `pw≥8` - Password at least 8 characters
343
+ - `age[18,65]` - Age between 18 and 65
344
+ - `retry<5` - Retry count less than 5
345
+ - `status∈{{active,pending}}` - Status in set
302
346
 
303
347
  ---
304
348
 
305
- ## The `.voodocs.context` File
306
-
307
- **Location**: `./.voodocs.context`
308
- **Format**: YAML
309
- **Purpose**: Single source of truth for project understanding
310
-
311
- ### Structure
312
-
313
- ```yaml
314
- project:
315
- name: "{project_name}"
316
- purpose: "{project_purpose}"
317
- domain: "Application domain"
318
-
319
- versioning:
320
- code_version: "1.0.0"
321
- context_version: "1.0"
322
- last_updated: "2025-12-19"
323
-
324
- invariants:
325
- global:
326
- - "All passwords must be hashed before storage"
327
- - "API keys must never be logged"
328
- - "All database queries must use parameterized statements"
329
-
330
- assumptions:
331
- - "Database connection is established at startup"
332
- - "User authentication is handled by auth service"
333
-
334
- architecture:
335
- modules:
336
- module-name:
337
- purpose: "What this module does"
338
- dependencies: ["other-module"]
339
-
340
- dependencies:
341
- external:
342
- - name: "library-name"
343
- version: "1.0.0"
344
- purpose: "Why we use it"
345
-
346
- critical_paths:
347
- - name: "User Login Flow"
348
- steps:
349
- - "User enters credentials"
350
- - "Credentials validated"
351
- - "JWT token generated"
352
- - "Token returned to client"
353
- ```
349
+ ## Enhanced Abbreviations
354
350
 
355
- ---
351
+ Use these abbreviations for maximum token efficiency:
356
352
 
357
- ## @voodocs Annotations
353
+ **Core:** `u` (user), `pw` (password), `auth` (authentication), `tok` (token), `svc` (service), `db` (database), `req` (request), `res` (response), `ret` (return), `err` (error)
358
354
 
359
- ### Purpose
355
+ **Web/API:** `ep` (endpoint), `rt` (route), `mw` (middleware), `hdlr` (handler), `ctrl` (controller), `api` (API)
360
356
 
361
- Annotations are **structured comments** that document:
362
- - What a module does
363
- - What it depends on
364
- - What assumptions it makes
365
- - What invariants it enforces
357
+ **Security:** `enc` (encryption), `dec` (decryption), `hash` (hashing), `sig` (signature), `cert` (certificate), `perm` (permission)
366
358
 
367
- ### Format
359
+ **Data:** `tbl` (table), `col` (column), `rec` (record), `idx` (index), `qry` (query), `txn` (transaction)
368
360
 
369
- **Python:**
370
- ```python
371
- \"\"\"@voodocs
372
- module_purpose: "User authentication and session management"
373
- dependencies: [
374
- "bcrypt: Password hashing",
375
- "jwt: Token generation",
376
- "database: User storage"
377
- ]
378
- assumptions: [
379
- "Database connection is available",
380
- "Redis is running for session storage"
381
- ]
382
- invariants: [
383
- "Passwords must be hashed with bcrypt",
384
- "Sessions must expire after 24 hours",
385
- "Failed login attempts must be rate-limited"
386
- ]
387
- security_model: "Passwords hashed with bcrypt (cost 12), JWTs expire in 24h, rate limiting on failed attempts"
388
- performance_notes: "O(1) for session lookup (Redis), O(log n) for user lookup (indexed database)"
389
- \"\"\"
361
+ ---
390
362
 
391
- def authenticate_user(username: str, password: str) -> Optional[str]:
392
- # Implementation
393
- pass
394
- ```
363
+ ## Example Annotation
395
364
 
396
- **TypeScript:**
397
365
  ```typescript
398
- /**@voodocs
399
- module_purpose: "API client for backend communication"
400
- dependencies: [
401
- "axios: HTTP client",
402
- "zod: Response validation"
403
- ]
404
- assumptions: [
405
- "API endpoint is reachable",
406
- "User has valid authentication token"
407
- ]
408
- invariants: [
409
- "All API responses must be validated",
410
- "Network errors must be handled gracefully",
411
- "Retry logic must use exponential backoff"
412
- ]
366
+ /**@darkarts
367
+ ⊢{{u auth svc w/ JWT tok gen}}
368
+ ∂{{bcrypt,jsonwebtoken,db}}
369
+ ⚠{{db conn established,u tbl exists}}
370
+ ⊳{{email:email,pw≥8}}
371
+ ⊲{{ret JWT tok|null}}
372
+ ⊨{{no pw log,no db mod}}
373
+ ⊕{{logs auth attempt,updates last_login}}
374
+ ⊗{{no pw in logs,no tok in logs}}
375
+ 🔒{{pw:hash,tok:enc,sess:secure}}
376
+ ⚡{{O(1)|hash-lookup}}
377
+ ⇄{{login↔logout}}
378
+ ∴{{invalid→null,expired→refresh}}
379
+ ∀{{users have unique email}}
380
+ ∃{{admin role required}}
381
+ ≈{{~50ms}}
413
382
  */
414
-
415
- export class ApiClient {{
416
- // Implementation
383
+ async function authenticateUser(email, password) {{
384
+ // Implementation
417
385
  }}
418
386
  ```
419
387
 
420
- ### Fields
421
-
422
- | Field | Required | Description |
423
- |-------|----------|-------------|
424
- | `module_purpose` | Yes | Brief description of what this module does |
425
- | `dependencies` | No | List of dependencies (internal and external) |
426
- | `assumptions` | No | What must be true for this module to work |
427
- | `invariants` | No | Rules that must always hold |
428
- | `security_model` | No | How security is handled |
429
- | `performance_notes` | No | Expected performance characteristics |
430
-
431
388
  ---
432
389
 
433
- ## Command Reference
434
-
435
- ### Context Management
436
-
437
- | Command | Purpose |
438
- |---------|---------|
439
- | `voodocs context init` | Initialize context file |
440
- | `voodocs context view` | View context as Markdown |
441
- | `voodocs context status` | Show context status |
442
-
443
- ### Auto-Generation
444
-
445
- | Command | Purpose |
446
- |---------|---------|
447
- | `voodocs context generate` | Generate context from code |
448
- | `voodocs context generate --update` | Update existing context |
449
-
450
- ### Validation
451
-
452
- | Command | Purpose |
453
- |---------|---------|
454
- | `voodocs context validate` | Validate context file |
455
- | `voodocs context validate --check-invariants` | Validate + check code |
456
- | `voodocs context check` | Check code against invariants |
457
- | `voodocs context check --format json` | JSON output for CI/CD |
458
-
459
- ### Querying
460
-
461
- | Command | Purpose |
462
- |---------|---------|
463
- | `voodocs context query "term"` | Search all sections |
464
- | `voodocs context query "term" --section invariants` | Search specific section |
465
- | `voodocs context query "term" --format json` | JSON output |
466
-
467
- ### Versioning
468
-
469
- | Command | Purpose |
470
- |---------|---------|
471
- | `voodocs context update` | Update context version |
472
- | `voodocs context sync` | Sync with code version |
473
- | `voodocs context history` | Show version history |
474
- | `voodocs context diff v1 v2` | Compare versions |
390
+ ## Your Tasks
475
391
 
476
- ### Visualization
477
-
478
- | Command | Purpose |
479
- |---------|---------|
480
- | `voodocs context diagram --type modules` | Module diagram |
481
- | `voodocs context diagram --type dependencies` | Dependency diagram |
482
- | `voodocs context diagram --type flow` | Flow diagram |
483
- | `voodocs context diagram --type all` | All diagrams |
392
+ 1. **When writing new code**: Add @darkarts annotations using mathematical notation
393
+ 2. **When modifying code**: Update existing @darkarts annotations
394
+ 3. **When reviewing code**: Check that annotations are accurate and complete
395
+ 4. **When documenting**: Use pattern shortcuts and abbreviations for maximum efficiency
484
396
 
485
397
  ---
486
398
 
487
- ## Development Workflow
488
-
489
- ### 1. Before Starting Work
490
-
491
- ```bash
492
- # Read the context
493
- voodocs context view
494
-
495
- # Check current status
496
- voodocs context status
497
-
498
- # Validate everything
499
- voodocs context validate --check-invariants
500
- ```
501
-
502
- ### 2. During Development
399
+ ## Token Efficiency Goal
503
400
 
504
- ```bash
505
- # Add @voodocs annotations to your code
506
- # (See annotation format above)
507
-
508
- # Update context from annotations
509
- voodocs context generate --update
510
-
511
- # Check if code respects invariants
512
- voodocs context check
513
- ```
514
-
515
- ### 3. Before Committing
516
-
517
- ```bash
518
- # Final validation
519
- voodocs context validate --check-invariants
520
-
521
- # Update context version
522
- voodocs context update --description "Added user authentication module"
523
-
524
- # Generate updated diagrams
525
- voodocs context diagram --type all --output docs/architecture
526
- ```
527
-
528
- ### 4. During Code Review
529
-
530
- ```bash
531
- # Compare context versions
532
- voodocs context diff v1.0 v1.1
533
-
534
- # Check specific invariant
535
- voodocs context check --invariant "password"
536
-
537
- # Query for specific information
538
- voodocs context query "authentication" --section assumptions
539
- ```
401
+ - Traditional comment: ~140 tokens
402
+ - DarkArts v3.0.0: ~30 tokens
403
+ - **Target: 79% reduction**
540
404
 
541
405
  ---
542
406
 
543
- ## Invariant Checking
407
+ ## Commands Available
544
408
 
545
- ### What Are Invariants?
409
+ - `voodocs context view` - View project context
410
+ - `voodocs context check` - Check invariants
411
+ - `voodocs validate` - Validate annotations
412
+ - `voodocs companion` - Generate human-readable docs
546
413
 
547
- Invariants are **rules that must always hold**. Examples:
548
- - "All passwords must be hashed before storage"
549
- - "API keys must never be logged"
550
- - "All database queries must use parameterized statements"
551
-
552
- ### How It Works
553
-
554
- The invariant checker uses **pattern-based detection** to find violations:
555
-
556
- ```bash
557
- voodocs context check
558
- ```
559
-
560
- **Output:**
561
- ```
562
- ✅ All passwords must be hashed before storage
563
- No violations found
564
-
565
- ❌ API keys must never be logged
566
- Found 2 potential violation(s):
567
-
568
- 📍 src/auth.py:45
569
- logger.info(f"Using API key: {{api_key}}")
570
- → API keys/secrets should not be logged
571
- ```
414
+ ---
572
415
 
573
- ### Supported Patterns
416
+ ## Remember
574
417
 
575
- - Password security (hashing detection)
576
- - API key protection (logging detection)
577
- - SQL injection prevention (parameterized queries)
578
- - Input validation
579
- - Null/None checking
580
- - Error handling
418
+ - **Use mathematical symbols** - Not English words
419
+ - **Use pattern shortcuts** - `:uuid`, `≥8`, etc.
420
+ - **Use abbreviations** - `u`, `auth`, `svc`, etc.
421
+ - **Be concise** - Maximum token efficiency
422
+ - **Be precise** - Mathematical symbols have exact meanings
581
423
 
582
424
  ---
583
425
 
584
- ## Architecture Diagrams
585
-
586
- ### Generate Diagrams
426
+ **DarkArts v3.0.0** - Designed by AI, for AI.
427
+ """
587
428
 
588
- ```bash
589
- # Module dependency diagram
590
- voodocs context diagram --type modules --output architecture.mmd
591
429
 
592
- # External dependencies
593
- voodocs context diagram --type dependencies --output dependencies.mmd
430
+ def generate_default_instructions() -> str:
431
+ """
432
+ Generate default DarkArts v3.0.0 instructions for any AI.
433
+
434
+ Returns:
435
+ General instructions for AI assistants
436
+ """
437
+ return """# DarkArts v3.0.0 - AI Assistant Instructions
594
438
 
595
- # Critical path workflows
596
- voodocs context diagram --type flow --output flows.mmd
597
- ```
439
+ ## Overview
598
440
 
599
- ### Viewing Diagrams
441
+ You are working with **DarkArts v3.0.0**, an AI-native mathematical notation system for code documentation.
600
442
 
601
- The diagrams are generated in **Mermaid** format. View them:
602
- - Copy to [Mermaid Live Editor](https://mermaid.live)
603
- - Use VS Code with Mermaid extension
604
- - Render in GitHub (supports Mermaid in markdown)
443
+ **Philosophy**: DarkArts is designed **for AI, not humans**. It uses mathematical symbols for maximum token efficiency (79% reduction vs traditional comments).
605
444
 
606
445
  ---
607
446
 
608
- ## CI/CD Integration
609
-
610
- ### GitHub Actions
611
-
612
- ```yaml
613
- name: Context Validation
614
-
615
- on: [push, pull_request]
616
-
617
- jobs:
618
- validate:
619
- runs-on: ubuntu-latest
620
- steps:
621
- - uses: actions/checkout@v2
622
-
623
- - name: Install VooDocs
624
- run: npm install -g @voodocs/cli
625
-
626
- - name: Validate Context
627
- run: voodocs context validate --check-invariants
628
-
629
- - name: Check Invariants
630
- run: voodocs context check --format json > violations.json
631
-
632
- - name: Upload Report
633
- uses: actions/upload-artifact@v2
634
- with:
635
- name: context-report
636
- path: violations.json
637
- ```
447
+ ## Core Symbols
448
+
449
+ | Symbol | Meaning | Usage |
450
+ |--------|---------|-------|
451
+ | `⊢{...}` | Purpose | What this does |
452
+ | `∂{...}` | Dependencies | What it needs |
453
+ | `⚠{...}` | Assumptions | What must be true |
454
+ | `⊳{...}` | Preconditions | Input requirements |
455
+ | `⊲{...}` | Postconditions | Output guarantees |
456
+ | `⊨{...}` | Invariants | Rules that always hold |
457
+ | `⚡{...}` | Complexity | Time/space complexity |
458
+ | `🔒{...}` | Security | Security measures |
459
+
460
+ **New in v3.0.0:**
461
+
462
+ | Symbol | Meaning | Usage |
463
+ |--------|---------|-------|
464
+ | `⇄{...}` | Bidirectional | Reversible operations |
465
+ | `⊕{...}` | Side Effects | State modifications |
466
+ | `⊗{...}` | Forbidden | Must not do |
467
+ | `≈{...}` | Approximation | Acceptable error |
468
+ | `∴{...}` | Consequence | Logical implications |
469
+ | `∀{...}` | Universal | For all elements |
470
+ | `∃{...}` | Existential | Must exist |
638
471
 
639
472
  ---
640
473
 
641
- ## Best Practices
642
-
643
- ### 1. Read Context First
644
- Always run `voodocs context view` before making changes.
474
+ ## Pattern Shortcuts
645
475
 
646
- ### 2. Document As You Code
647
- Add @voodocs annotations while writing code, not after.
476
+ **Type patterns:**
477
+ - `:uuid`, `:email`, `:url`, `:json`, `:jwt`, `:hash`, `:enc`
648
478
 
649
- ### 3. Keep Invariants Specific
650
- Bad: "Data must be valid"
651
- ✅ Good: "All user input must be validated using Zod schemas"
479
+ **Numeric patterns:**
480
+ - `≥N`, `≤N`, `>N`, `<N`, `[N,M]`, `∈{...}`
652
481
 
653
- ### 4. Update Regularly
654
- Run `voodocs context generate --update` frequently during development.
482
+ **Examples:**
483
+ - `id:uuid` - ID must be valid UUID
484
+ - `pw≥8` - Password at least 8 characters
485
+ - `age[18,65]` - Age between 18 and 65
655
486
 
656
- ### 5. Validate Before Commit
657
- Always run `voodocs context check` before committing.
487
+ ---
658
488
 
659
- ### 6. Track Changes
660
- Use `voodocs context update` to document what changed and why.
489
+ ## Abbreviations
661
490
 
662
- ### 7. Query for Understanding
663
- Use `voodocs context query` to quickly find information.
491
+ Use these for maximum token efficiency:
664
492
 
665
- ### 8. Generate Diagrams
666
- Keep architecture diagrams up-to-date with `voodocs context diagram`.
493
+ **Core:** `u`, `pw`, `auth`, `tok`, `svc`, `db`, `req`, `res`, `ret`, `err`
494
+ **Web:** `ep`, `rt`, `mw`, `hdlr`, `ctrl`, `api`
495
+ **Security:** `enc`, `dec`, `hash`, `sig`, `cert`, `perm`
496
+ **Data:** `tbl`, `col`, `rec`, `idx`, `qry`, `txn`
667
497
 
668
498
  ---
669
499
 
670
- ## Troubleshooting
671
-
672
- ### "No modules found in context"
673
-
674
- **Problem**: Trying to generate module diagram but no modules defined.
675
-
676
- **Solution**: Add modules to `.voodocs.context`:
677
- ```yaml
678
- architecture:
679
- modules:
680
- module-name:
681
- purpose: "What it does"
682
- dependencies: []
500
+ ## Example
501
+
502
+ ```javascript
503
+ /**@darkarts
504
+ ⊢{u auth svc w/ JWT tok gen}
505
+ ∂{bcrypt,jsonwebtoken,db}
506
+ ⊳{email:email,pw≥8}
507
+ ⊲{ret JWT tok|null}
508
+ ⊨{no pw log}
509
+ ⊕{logs auth,updates last_login}
510
+ ⊗{no pw in logs}
511
+ 🔒{pw:hash,tok:enc}
512
+ ⚡{O(1)}
513
+ */
514
+ async function authenticateUser(email, password) {
515
+ // Implementation
516
+ }
683
517
  ```
684
518
 
685
- Or add `module_purpose` to @voodocs annotations and regenerate.
686
-
687
- ### "Invariant violations found"
688
-
689
- **Problem**: Code doesn't respect documented invariants.
690
-
691
- **Solution**:
692
- 1. Review the violation report
693
- 2. Fix the code to respect the invariant
694
- 3. Or update the invariant if it's incorrect
695
-
696
- ### "Context file not found"
697
-
698
- **Problem**: No `.voodocs.context` file exists.
699
-
700
- **Solution**: Run `voodocs context init` to create one.
701
-
702
519
  ---
703
520
 
704
- ## Summary
705
-
706
- The VooDocs Context System is your **single source of truth** for:
707
- - ✅ Project understanding
708
- - ✅ Architecture documentation
709
- - ✅ Code validation
710
- - ✅ Change tracking
711
- - ✅ Visual documentation
521
+ ## Your Responsibilities
712
522
 
713
- **Always check context before making changes!**
523
+ 1. **Write annotations** using mathematical notation
524
+ 2. **Use pattern shortcuts** for validations
525
+ 3. **Use abbreviations** for maximum efficiency
526
+ 4. **Be precise** with mathematical symbols
527
+ 5. **Document invariants** that must always hold
528
+ 6. **Document side effects** that modify state
529
+ 7. **Document forbidden operations** that must not happen
714
530
 
715
531
  ---
716
532
 
717
- **VooDocs v0.2.0+** - AI-native documentation that keeps code and context in sync.
533
+ **DarkArts v3.0.0** - The AI-Native Mathematical Language for Code
718
534
  """
719
535
 
720
536
 
721
- def generate_ai_instructions(project_name: str, project_purpose: str, ai_type: str = "cursor") -> Dict[str, str]:
537
+ # Template registry
538
+ TEMPLATES = {
539
+ 'cursor': generate_cursorrules,
540
+ 'claude': generate_claude_instructions,
541
+ 'default': lambda *args: generate_default_instructions()
542
+ }
543
+
544
+
545
+ def get_template(ai_type: str = 'default') -> callable:
722
546
  """
723
- Generate AI instruction files for different AI assistants.
547
+ Get instruction template for specific AI type.
724
548
 
725
549
  Args:
726
- project_name: Name of the project
727
- project_purpose: Brief purpose of the project
728
- ai_type: Type of AI assistant ("cursor", "claude", "copilot", "all")
550
+ ai_type: Type of AI assistant ('cursor', 'claude', 'default')
729
551
 
730
552
  Returns:
731
- Dictionary mapping filename to content
553
+ Template generation function
732
554
  """
733
- instructions = {}
734
-
735
- if ai_type in ["cursor", "all"]:
736
- instructions[".cursorrules"] = generate_cursorrules(project_name, project_purpose)
737
-
738
- if ai_type in ["all", "cursor", "claude", "copilot"]:
739
- instructions["VOODOCS_CONTEXT_GUIDE.md"] = generate_context_guide(project_name, project_purpose)
740
-
741
- return instructions
555
+ return TEMPLATES.get(ai_type, TEMPLATES['default'])