axiom-coding-agent-setup 1.0.11 → 1.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.
Files changed (35) hide show
  1. package/.agents/CONTEXT-MANAGEMENT.md +155 -0
  2. package/.agents/DEBUGGING.md +124 -0
  3. package/.agents/{engineering.md → ENGINEERING.md} +6 -0
  4. package/.agents/PERFORMANCE.md +164 -0
  5. package/.agents/SECURITY.md +109 -0
  6. package/.agents/{workflow.md → WORKFLOW.md} +7 -1
  7. package/.agents/skills/project-design/SKILL.md +207 -0
  8. package/.agents/skills/project-design/references/ARCHITECTURE.md +641 -0
  9. package/.agents/skills/project-design/references/PROJECT_PLAN.md +316 -0
  10. package/.agents/skills/skill-creator/LICENSE.txt +202 -0
  11. package/.agents/skills/skill-creator/SKILL.md +485 -0
  12. package/.agents/skills/skill-creator/agents/analyzer.md +274 -0
  13. package/.agents/skills/skill-creator/agents/comparator.md +202 -0
  14. package/.agents/skills/skill-creator/agents/grader.md +223 -0
  15. package/.agents/skills/skill-creator/assets/eval_review.html +146 -0
  16. package/.agents/skills/skill-creator/eval-viewer/generate_review.py +471 -0
  17. package/.agents/skills/skill-creator/eval-viewer/viewer.html +1325 -0
  18. package/.agents/skills/skill-creator/references/schemas.md +430 -0
  19. package/.agents/skills/skill-creator/scripts/__init__.py +0 -0
  20. package/.agents/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
  21. package/.agents/skills/skill-creator/scripts/generate_report.py +326 -0
  22. package/.agents/skills/skill-creator/scripts/improve_description.py +247 -0
  23. package/.agents/skills/skill-creator/scripts/package_skill.py +136 -0
  24. package/.agents/skills/skill-creator/scripts/quick_validate.py +103 -0
  25. package/.agents/skills/skill-creator/scripts/run_eval.py +310 -0
  26. package/.agents/skills/skill-creator/scripts/run_loop.py +328 -0
  27. package/.agents/skills/skill-creator/scripts/utils.py +47 -0
  28. package/AGENTS.md +68 -4
  29. package/README.md +42 -6
  30. package/bin/cli.js +15 -6
  31. package/package.json +1 -1
  32. package/plugin/oh-my-openagent.json +198 -0
  33. package/plugin/oh-my-openagent.md +49 -0
  34. package/skills-lock.json +6 -0
  35. /package/.agents/{stack.md → STACK.md} +0 -0
@@ -0,0 +1,155 @@
1
+ # Context Management
2
+
3
+ ## The Context Problem
4
+
5
+ AI agents have limited context windows. Every token counts. Wasted context = degraded reasoning = worse output. Managing context is a core competency of a world-class agent.
6
+
7
+ ---
8
+
9
+ ## Context Budget Principles
10
+
11
+ ### The 50% Rule
12
+ When context reaches ~50% of the window, proactively compact. Don't wait until you're forced to.
13
+
14
+ ### Every Token Must Earn Its Place
15
+ Before including anything in context, ask:
16
+ - Does this directly help solve the current task?
17
+ - Can I summarize this instead of including it verbatim?
18
+ - Is this already known from the conversation history?
19
+ - Would a file reference suffice instead of the full content?
20
+
21
+ ### Read Before Claiming, But Don't Read Everything
22
+ - Read files that are directly relevant to the current task
23
+ - Use search tools (grep, ast-grep) to find specific patterns without reading entire files
24
+ - Batch read multiple files when you know they're all needed
25
+ - Stop reading once you have sufficient understanding
26
+
27
+ ---
28
+
29
+ ## Context Compaction Strategy
30
+
31
+ ### When to Compact
32
+ - Context exceeds 50% of window
33
+ - Starting a new sub-task within the same session
34
+ - Switching from exploration to implementation
35
+ - Before making a complex, multi-step change
36
+
37
+ ### How to Compact
38
+ 1. **Summarize conversation history** — Replace long exchanges with key decisions and current state
39
+ 2. **Remove completed work** — Move done items to a summary; keep only what's still open
40
+ 3. **Replace file contents with references** — "See `src/auth.ts` for implementation" vs. full file content
41
+ 4. **Use todo lists** — Track state externally (todo tool) instead of in conversation
42
+ 5. **Extract key findings** — Move exploration results into a concise summary
43
+
44
+ ### The Compact Format
45
+ ```
46
+ ## Session Summary
47
+ - Task: [one-line description]
48
+ - Status: [in progress / blocked / completed]
49
+ - Key decisions: [bullet list]
50
+ - Open items: [from todo list]
51
+ - Relevant files: [file paths only, not contents]
52
+ ```
53
+
54
+ ---
55
+
56
+ ## Session Discipline
57
+
58
+ ### One Task Per Session
59
+ Switching tasks mid-session degrades quality. Use `/clear` or start a new session when pivoting.
60
+
61
+ ### Session Lifecycle
62
+ 1. **Setup** — Load relevant skills, read initial files, clarify requirements
63
+ 2. **Exploration** — Search codebase, understand patterns, identify files to change
64
+ 3. **Implementation** — Make changes, verify, test
65
+ 4. **Verification** — Run tests, check for regressions, confirm requirements met
66
+ 5. **Handoff** — Summarize what changed, what's still open, what needs follow-up
67
+
68
+ ### Handoff Documentation
69
+ When ending a session or passing to another agent:
70
+ - What was completed
71
+ - What is still in progress
72
+ - What decisions were made and why
73
+ - What blockers exist
74
+ - What files were changed
75
+ - What tests were run and their results
76
+
77
+ ---
78
+
79
+ ## Parallel Execution & Context
80
+
81
+ ### When to Parallelize
82
+ - Multiple independent file reads
83
+ - Multiple search queries
84
+ - Multiple test runs
85
+ - Independent implementation tasks
86
+
87
+ ### When NOT to Parallelize
88
+ - Tasks that depend on each other's output
89
+ - Tasks that modify the same files
90
+ - Tasks that share mutable state
91
+
92
+ ### Context Isolation
93
+ Each parallel agent/worker should receive:
94
+ - The specific task it's responsible for
95
+ - The minimal context needed for that task
96
+ - Clear boundaries on what it should NOT touch
97
+
98
+ ---
99
+
100
+ ## Codebase Navigation Without Context Bloat
101
+
102
+ ### Grepping > Reading
103
+ Use grep/ast-grep to find specific patterns without loading entire files into context.
104
+
105
+ ### Symbol Search > File Reading
106
+ Use LSP symbol search to find where something is defined, then read only that definition.
107
+
108
+ ### References > Full Content
109
+ When you've already read a file once, reference it by path. Don't re-read it unless you need to verify current state.
110
+
111
+ ### Tree > List
112
+ Use `tree` with depth limits to understand structure without listing every file.
113
+
114
+ ---
115
+
116
+ ## Memory Management for Long Sessions
117
+
118
+ ### Progressive Disclosure
119
+ 1. Start with high-level overview (tree, key files)
120
+ 2. Read relevant files as needed
121
+ 3. Compact and summarize before diving deeper
122
+ 4. Reference, don't repeat
123
+
124
+ ### The Rule of Three
125
+ If you find yourself re-reading the same file more than 3 times in a session, something is wrong:
126
+ - You didn't understand it the first time (take notes)
127
+ - You're working on too many things at once (narrow scope)
128
+ - The file is too large and needs refactoring (flag it)
129
+
130
+ ### State Persistence
131
+ Use external tools for state:
132
+ - **Todo lists** — Track progress without consuming context
133
+ - **File system** — Write summaries to temp files
134
+ - **Session state** — Use session variables for cross-turn data
135
+
136
+ ---
137
+
138
+ ## Context Anti-Patterns
139
+
140
+ | Anti-Pattern | Why It Hurts |
141
+ |---|---|
142
+ | **Including entire files** | Eats context budget; most of the file is irrelevant |
143
+ | **Repeating history** | Every turn doesn't need full conversation replay |
144
+ | **Loading unrelated skills** | Only load skills relevant to the current task |
145
+ | **Parallelizing dependent tasks** | Results in conflicts, wasted work, context pollution |
146
+ | **Never compacting** | Context degrades until the agent starts hallucinating or making mistakes |
147
+ | **Over-reading** | Reading 20 files when 3 would suffice |
148
+
149
+ ---
150
+
151
+ ## The Ultimate Rule
152
+
153
+ **Context is your most precious resource. Spend it wisely.**
154
+
155
+ Every byte of context should directly contribute to producing correct, high-quality output. If it doesn't, remove it.
@@ -0,0 +1,124 @@
1
+ # Debugging Methodology
2
+
3
+ ## The Golden Rule of Debugging
4
+
5
+ **Never guess. Always observe.**
6
+
7
+ Debugging is not about being smart — it's about being systematic. The fastest way to fix a bug is to understand it completely before touching code.
8
+
9
+ ---
10
+
11
+ ## The Debugging Protocol
12
+
13
+ ### Phase 1: Reproduction
14
+ 1. **Can you reproduce it consistently?** If not, find the pattern.
15
+ 2. **What are the exact steps?** Document them precisely.
16
+ 3. **What is the smallest input that triggers it?** Minimize the reproduction case.
17
+ 4. **When did it last work?** Use `git bisect` to find the offending commit.
18
+
19
+ ### Phase 2: Observation
20
+ 1. **Read the error message carefully** — not just the first line, the full stack trace
21
+ 2. **Check the obvious first** — null pointers, off-by-one, typos, recent changes
22
+ 3. **Inspect the state** — print/LOG variables at key points; don't assume you know their values
23
+ 4. **Trace the data flow** — where does the bad value come from?
24
+ 5. **Check boundaries** — empty collections, first/last items, zero, null, max values
25
+ 6. **Check the environment** — different OS, different Node version, different database state
26
+
27
+ ### Phase 3: Hypothesis
28
+ 1. **Form a specific, testable hypothesis** — "The bug is caused by X because Y"
29
+ 2. **Design an experiment to prove or disprove it** — a test, a log, a minimal change
30
+ 3. **If disproven, discard and form a new hypothesis** — don't cling to wrong theories
31
+ 4. **If proven, fix the root cause** — not the symptom
32
+
33
+ ### Phase 4: Fix & Verify
34
+ 1. **Fix the root cause, not the symptom** — suppressing the error message is not fixing the bug
35
+ 2. **Verify the fix** — run the reproduction case; it should pass
36
+ 3. **Verify you didn't break anything else** — run the full test suite
37
+ 4. **Add a regression test** — ensure this bug never returns
38
+ 5. **Document what you learned** — if it was tricky, save the next engineer the trouble
39
+
40
+ ---
41
+
42
+ ## Debugging Techniques
43
+
44
+ ### Binary Search (Divide and Conquer)
45
+ When you don't know where the bug is:
46
+ 1. Add a check/log at the midpoint of the suspected code path
47
+ 2. Determine if the bug is before or after that point
48
+ 3. Repeat, halving the search space each time
49
+
50
+ ### Rubber Duck Debugging
51
+ Explain the bug out loud (or in writing) to an inanimate object. Forcing yourself to articulate the problem often reveals the solution.
52
+
53
+ ### Git Bisect
54
+ When you know it worked before:
55
+ ```bash
56
+ git bisect start
57
+ git bisect bad HEAD
58
+ git bisect good <last-known-good-commit>
59
+ # Git will checkout commits; test and mark good/bad until it finds the culprit
60
+ ```
61
+
62
+ ### Backwards from the Error
63
+ Start at the crash/error and trace backwards:
64
+ 1. What function threw the error?
65
+ 2. What called that function?
66
+ 3. What data was passed?
67
+ 4. Where did that data come from?
68
+
69
+ ### Isolate Variables
70
+ Change one thing at a time:
71
+ - Does it fail on a different machine?
72
+ - Does it fail with a different database?
73
+ - Does it fail with different input?
74
+ - Does it fail with the previous commit?
75
+
76
+ ---
77
+
78
+ ## Common Bug Categories & Patterns
79
+
80
+ | Symptom | Likely Causes |
81
+ |---|---|
82
+ | Works on my machine | Environment differences, missing env vars, different versions |
83
+ | Intermittent failure | Race condition, timing issue, external dependency flakiness |
84
+ | Works after restart | Memory leak, state corruption, resource exhaustion |
85
+ | Only fails with large data | Buffer overflow, timeout, memory limit, algorithmic complexity |
86
+ | Works in tests, fails in prod | Different data, different config, different permissions |
87
+ | Works in prod, fails in tests | Test isolation, mock mismatch, different environment setup |
88
+
89
+ ---
90
+
91
+ ## Anti-Patterns to Avoid
92
+
93
+ | Anti-Pattern | Why It Fails |
94
+ |---|---|
95
+ | **Shotgun debugging** | Randomly changing things hoping something works. You learn nothing and introduce new bugs. |
96
+ | **Print-driven development** | Adding `console.log` everywhere instead of understanding the flow. Clutters code and output. |
97
+ | **Commenting out code** | "Maybe if I disable this..." You hide the symptom without fixing the cause. |
98
+ | **Blaming the compiler/framework** | It's almost never the compiler. Check your assumptions first. |
99
+ | **Ignoring the stack trace** | The answer is usually in the stack trace. Read it fully. |
100
+ | **Fixing without reproducing** | If you can't reproduce it, you can't verify your fix. |
101
+ | **Not adding a regression test** | The same bug will come back. Guaranteed. |
102
+
103
+ ---
104
+
105
+ ## Debugging Tools
106
+
107
+ - **Stack traces** — Read bottom-up: the error is at the bottom, the call chain above it
108
+ - **Breakpoints** — Pause execution and inspect state (better than print statements)
109
+ - **Diff tools** — Compare working vs broken state (files, configs, database dumps)
110
+ - **Log aggregation** — Centralized logs for tracing requests across services
111
+ - **Request tracing** — Trace IDs to follow a single request through multiple services
112
+
113
+ ---
114
+
115
+ ## When to Ask for Help
116
+
117
+ Stop and escalate when:
118
+ - You've spent 30+ minutes without progress
119
+ - The bug involves a third-party library you don't control
120
+ - It requires access to production data or systems you don't have
121
+ - You're tempted to add a hack/workaround instead of a real fix
122
+ - The fix would change security-critical code
123
+
124
+ **Debugging is a skill. The more methodical you are, the faster you solve problems.**
@@ -122,6 +122,12 @@ Log what's surprising, not what's expected.
122
122
  | Untested happy paths | You find bugs in production, not staging |
123
123
  | Architecture by autocomplete | AI-generated structure without architectural judgment |
124
124
  | Dependency sprawl | Each dependency is a supply chain risk and a maintenance burden |
125
+ | Blind retries | Same failed command in a loop; wastes time and obscures real issues. See WORKFLOW.md |
126
+ | Suppressing type errors | `as any`, `@ts-ignore` hide real bugs; fix the root cause. See AGENTS.md |
127
+ | Empty catch blocks | `catch(e) {}` swallows errors; log and handle or don't catch. See AGENTS.md |
128
+ | Cargo-culting patterns | Copying solutions without understanding why; wrong tool for the job. See AGENTS.md |
129
+
130
+ > **Domain-specific anti-patterns:** See DEBUGGING.md (debugging anti-patterns) and PERFORMANCE.md (performance anti-patterns) for detailed coverage.
125
131
 
126
132
  ---
127
133
 
@@ -0,0 +1,164 @@
1
+ # Performance Awareness
2
+
3
+ ## Mindset: Measure First, Optimize Second
4
+
5
+ Premature optimization is the root of all evil — but so is shipping code that falls over at scale. The key is knowing when to care and what to measure.
6
+
7
+ ---
8
+
9
+ ## The Performance Hierarchy
10
+
11
+ Optimize in this order:
12
+
13
+ 1. **Algorithmic complexity** — O(n²) will always beat O(n) eventually, regardless of micro-optimizations
14
+ 2. **Database queries** — N+1 queries, missing indexes, and full table scans kill performance
15
+ 3. **I/O bottlenecks** — Network calls, disk reads, file system operations
16
+ 4. **Memory allocation** — Excessive object creation, memory leaks, large data structures
17
+ 5. **Micro-optimizations** — Loop unrolling, cache locality (last resort, measure impact)
18
+
19
+ ---
20
+
21
+ ## Key Metrics
22
+
23
+ ### Response Time
24
+ | Target | Acceptable | Warning | Critical |
25
+ |---|---|---|---|
26
+ | API response | < 100ms | < 500ms | > 1s |
27
+ | Page load | < 1s | < 3s | > 5s |
28
+ | Database query | < 10ms | < 100ms | > 500ms |
29
+
30
+ ### Throughput
31
+ - Requests per second (RPS) your system can handle
32
+ - Concurrent connections supported
33
+ - Queue depth and wait times
34
+
35
+ ### Resource Utilization
36
+ - CPU: sustained > 70% is a warning
37
+ - Memory: monitor for leaks and growth over time
38
+ - Disk I/O: random reads are expensive; sequential is cheap
39
+ - Network: bandwidth and latency to dependent services
40
+
41
+ ---
42
+
43
+ ## Caching Strategy
44
+
45
+ ### When to Cache
46
+ - **Static assets** — Cache aggressively (CDN, browser cache)
47
+ - **Database queries** — Cache results that change infrequently
48
+ - **Computed values** — Cache expensive calculations
49
+ - **API responses** — Cache external API calls with appropriate TTL
50
+
51
+ ### When NOT to Cache
52
+ - **User-specific data** — unless scoped to that user
53
+ - **Real-time data** — stock prices, live feeds
54
+ - **Small, cheap computations** — cache overhead > computation cost
55
+ - **Data that must be consistent** — cache invalidation is hard
56
+
57
+ ### Cache Invalidation
58
+ ```
59
+ "There are only two hard things in Computer Science:
60
+ cache invalidation and naming things."
61
+ ```
62
+
63
+ - Prefer **TTL-based** expiration for simplicity
64
+ - Use **write-through** or **write-behind** for consistency-critical data
65
+ - **Never** cache without an invalidation strategy
66
+
67
+ ---
68
+
69
+ ## Database Performance
70
+
71
+ ### Query Optimization
72
+ - **Indexing** — Index columns used in WHERE, JOIN, ORDER BY. Don't over-index (writes slow down).
73
+ - **N+1 Problem** — Fetch related data in a single query (JOIN) or batch queries
74
+ - **Pagination** — Never `SELECT *` without LIMIT on large tables
75
+ - **Explain plans** — Use `EXPLAIN` (PostgreSQL) or `EXPLAIN ANALYZE` to understand query execution
76
+
77
+ ### Connection Management
78
+ - Use connection pooling (PgBouncer, SQLAlchemy pool, Prisma connection pool)
79
+ - Close connections promptly; don't leak them
80
+ - Monitor pool exhaustion
81
+
82
+ ---
83
+
84
+ ## Async & Concurrency
85
+
86
+ ### When to Use Async
87
+ - **I/O-bound work** — API calls, database queries, file reads
88
+ - **Many concurrent operations** — handling thousands of connections
89
+ - **Not for CPU-bound work** — use threads/processes instead
90
+
91
+ ### Concurrency Patterns
92
+ - **Batching** — Group small operations into larger ones
93
+ - **Parallelization** — Run independent operations concurrently
94
+ - **Streaming** — Process data as it arrives, not all at once
95
+ - **Backpressure** — Slow down producers when consumers can't keep up
96
+
97
+ ---
98
+
99
+ ## Frontend Performance
100
+
101
+ ### Core Web Vitals
102
+ - **LCP (Largest Contentful Paint)** — < 2.5s (main content loaded)
103
+ - **FID (First Input Delay)** — < 100ms (page is interactive)
104
+ - **CLS (Cumulative Layout Shift)** — < 0.1 (visual stability)
105
+
106
+ ### Techniques
107
+ - **Code splitting** — Load only what the user needs
108
+ - **Lazy loading** — Images, components, routes load on demand
109
+ - **Tree shaking** — Remove unused code at build time
110
+ - **Image optimization** — WebP, responsive sizes, lazy loading
111
+ - **Minimize main thread work** — Offload to web workers where possible
112
+
113
+ ---
114
+
115
+ ## Profiling & Measurement
116
+
117
+ ### Before Optimizing
118
+ 1. **Profile** — Find the actual bottleneck, not the suspected one
119
+ 2. **Benchmark** — Measure current performance as a baseline
120
+ 3. **Hypothesize** — Predict the impact of the optimization
121
+ 4. **Implement** — Make the change
122
+ 5. **Verify** — Did it actually help? If not, revert.
123
+
124
+ ### Tools
125
+ - **Node.js** — `node --prof`, clinic.js, 0x
126
+ - **Python** — cProfile, py-spot, line_profiler
127
+ - **Browser** — Chrome DevTools Performance tab, Lighthouse
128
+ - **Database** — `EXPLAIN ANALYZE`, `pg_stat_statements`, slow query log
129
+ - **System** — `htop`, `iotop`, `netstat`, Prometheus + Grafana
130
+
131
+ ---
132
+
133
+ ## Performance Anti-Patterns
134
+
135
+ | Anti-Pattern | Why It Hurts |
136
+ |---|---|
137
+ | **Optimizing without measuring** | You optimize the wrong thing. The real bottleneck remains. |
138
+ | **Caching everything** | Cache invalidation nightmares, stale data, memory bloat |
139
+ | **Ignoring Big O** | O(n²) with n=1000 is 1M operations. It will always be slow. |
140
+ | **Blocking the main thread** | In async systems, synchronous I/O blocks everything |
141
+ | **Loading everything at once** | Memory exhaustion, slow startup, poor UX |
142
+ | **No connection pooling** | Connection overhead dominates; database chokes |
143
+ | **Giant transactions** | Lock contention, timeouts, rollback nightmares |
144
+
145
+ ---
146
+
147
+ ## When Performance Matters
148
+
149
+ **Always:**
150
+ - User-facing response times
151
+ - APIs that serve mobile clients
152
+ - Batch processing that runs on a schedule
153
+
154
+ **Sometimes:**
155
+ - Internal tools (if used by many people)
156
+ - Build times (developer productivity)
157
+ - Test suite speed (feedback loop)
158
+
159
+ **Rarely:**
160
+ - One-off scripts
161
+ - Prototypes and MVPs (but document the debt)
162
+ - Code that's not on the critical path
163
+
164
+ **Measure. Then optimize. Then measure again.**
@@ -0,0 +1,109 @@
1
+ # Security Principles
2
+
3
+ ## Mindset: Security Is Not a Feature
4
+
5
+ Security is a property of every decision, not a checkbox at the end. Treat every input as malicious until proven otherwise. Treat every dependency as compromised until audited. Treat every secret as leaked until rotated.
6
+
7
+ ---
8
+
9
+ ## The Security Checklist
10
+
11
+ Before shipping any code, verify these:
12
+
13
+ ### Input Validation
14
+ - [ ] All user inputs are validated at trust boundaries (API, CLI, form, file upload)
15
+ - [ ] Validation happens before any processing — not as an afterthought
16
+ - [ ] Whitelist over blacklist: define what's allowed, not what's forbidden
17
+ - [ ] Type, length, format, and range are all constrained
18
+ - [ ] File uploads: check MIME type, extension, size, and scan for malicious content
19
+ - [ ] Deserialization: never blindly deserialize untrusted data (pickle, YAML, XML, JSON with custom decoders)
20
+
21
+ ### Secrets Management
22
+ - [ ] No hardcoded secrets in source code (API keys, passwords, tokens)
23
+ - [ ] Environment variables or secret managers only
24
+ - [ ] `.env` files are in `.gitignore`
25
+ - [ ] No secrets in logs, error messages, or stack traces
26
+ - [ ] Rotate secrets when team members leave or when compromise is suspected
27
+ - [ ] Different secrets for dev/staging/prod — never share production keys with dev environments
28
+
29
+ ### Authentication & Authorization
30
+ - [ ] Authentication on every endpoint that isn't explicitly public
31
+ - [ ] Principle of least privilege: users get the minimum access they need
32
+ - [ ] Never trust client-side authorization checks — verify on the server
33
+ - [ ] Session tokens: secure, httpOnly, sameSite cookies; short expiry with refresh tokens
34
+ - [ ] Rate limiting on auth endpoints (login, register, password reset)
35
+
36
+ ### Data Protection
37
+ - [ ] Sensitive data encrypted at rest (database, files, backups)
38
+ - [ ] Sensitive data encrypted in transit (TLS 1.2+, no downgrade)
39
+ - [ ] PII minimized: collect only what's necessary, delete when no longer needed
40
+ - [ ] Database queries parameterized — never string-concatenate SQL
41
+ - [ ] No sensitive data in URL parameters or client-side storage
42
+
43
+ ### Dependency Security
44
+ - [ ] Audit dependencies before adding them: maintenance status, known vulnerabilities, supply chain risk
45
+ - [ ] Pin versions in lock files; use `npm audit`, `pip-audit`, `cargo audit`
46
+ - [ ] Review what a dependency does before trusting it with secrets or user data
47
+ - [ ] Prefer well-maintained, widely-used libraries over obscure ones
48
+
49
+ ---
50
+
51
+ ## Common Attack Vectors
52
+
53
+ | Attack | Prevention |
54
+ |---|---|
55
+ | **Injection** (SQL, NoSQL, Command, LDAP) | Parameterized queries, input sanitization, avoid `eval`/`exec` |
56
+ | **XSS** (Cross-Site Scripting) | Escape output, Content-Security-Policy, sanitize HTML |
57
+ | **CSRF** (Cross-Site Request Forgery) | CSRF tokens, SameSite cookies, verify Origin header |
58
+ | **Path Traversal** | Canonicalize paths, whitelist allowed directories, no user-controlled paths |
59
+ | **SSRF** (Server-Side Request Forgery) | Whitelist outbound URLs, no user-controlled destinations |
60
+ | **Deserialization** | Avoid deserializing untrusted data; use safe formats (JSON with schema validation) |
61
+ | **IDOR** (Insecure Direct Object Reference) | Verify ownership on every resource access; use UUIDs not sequential IDs |
62
+ | **Race Conditions** | Atomic operations, proper locking, idempotent endpoints |
63
+
64
+ ---
65
+
66
+ ## Security-First Development Patterns
67
+
68
+ ### Defensive Coding
69
+ ```python
70
+ # BAD: Trusting user input
71
+ query = f"SELECT * FROM users WHERE id = {user_id}"
72
+
73
+ # GOOD: Parameterized query
74
+ cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))
75
+ ```
76
+
77
+ ### Fail Securely
78
+ ```python
79
+ # BAD: Default allow
80
+ if user.is_admin:
81
+ allow_access()
82
+ else:
83
+ deny_access()
84
+
85
+ # GOOD: Default deny
86
+ if not user.is_authenticated or not user.is_admin:
87
+ raise PermissionDenied()
88
+ allow_access()
89
+ ```
90
+
91
+ ### Secure Defaults
92
+ - Framework security features enabled by default (CSRF protection, XSS filters)
93
+ - No debug mode in production
94
+ - No open CORS (`*`) in production
95
+ - No stack traces exposed to end users
96
+
97
+ ---
98
+
99
+ ## When to Escalate
100
+
101
+ Stop and ask the human when:
102
+ - Handling production secrets or credentials
103
+ - Modifying authentication/authorization logic
104
+ - Adding new external dependencies with network access
105
+ - Processing sensitive user data (PII, health, financial)
106
+ - Deploying to production environments
107
+ - Anything involving encryption key management
108
+
109
+ **Security is not "I'll fix it later." Security is now.**
@@ -57,9 +57,12 @@ I apply this hierarchy before making any claim about a system:
57
57
  - If I discover something unexpected (a bug, a design issue, a missing dependency), surface it rather than silently working around it
58
58
 
59
59
  ### When Stuck
60
- - State what I know, what I've tried, and what specifically is unclear
60
+ - State what you know, what you've tried, and what specifically is unclear
61
61
  - Propose a path forward even if uncertain: "I think X, but I'm not sure about Y — can you verify?"
62
62
  - Never spin in place without surfacing the blocker
63
+ - **After 3 failed attempts on the same problem**: stop, revert to last known working state, and escalate to the human with full context
64
+ - **Never retry the same failed command blindly** — analyze the error, fix the root cause, then retry
65
+ - **Never enter infinite loops** — whether command retries, file edits, or test fixes: if it's not working, stop and explain
63
66
 
64
67
  ### Completing Work
65
68
  1. Verify the implementation empirically (not just by reading code)
@@ -110,6 +113,9 @@ When presenting solutions, include:
110
113
 
111
114
  ## Context Management (for Agentic Sessions)
112
115
 
116
+ > **For comprehensive context strategy**, see CONTEXT-MANAGEMENT.md — the 50% rule, compaction formats, parallel execution isolation, and navigation without bloat.
117
+
118
+ Quick reminders:
113
119
  - **Compact context proactively** — don't let context fill before acting; use `/compact` at ~50% context
114
120
  - **One task per session** — switching tasks mid-session degrades quality; use `/clear` when pivoting
115
121
  - **Recall relevant files by reading them** — don't rely on memory of previous edits in long sessions; re-read to confirm current state