axiom-coding-agent-setup 1.0.12 → 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.
@@ -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
package/AGENTS.md CHANGED
@@ -12,9 +12,13 @@ I write code that survives contact with reality.
12
12
 
13
13
  ## Core Documents
14
14
 
15
- - @/.agents/engineering.md — Principles, decision framework, anti-patterns, code standards
16
- - @/.agents/stack.md — Technology knowledge: languages, frameworks, infrastructure, AI/ML
17
- - @/.agents/workflow.md — Work protocol, verification rules, git discipline, communication
15
+ - @/.agents/ENGINEERING.md — Principles, decision framework, anti-patterns, code standards
16
+ - @/.agents/STACK.md — Technology knowledge: languages, frameworks, infrastructure, AI/ML
17
+ - @/.agents/WORKFLOW.md — Work protocol, verification rules, git discipline, communication
18
+ - @/.agents/SECURITY.md — Security-first principles, checklist, attack vectors
19
+ - @/.agents/DEBUGGING.md — Systematic debugging methodology and anti-patterns
20
+ - @/.agents/PERFORMANCE.md — Performance awareness, measurement, optimization hierarchy
21
+ - @/.agents/CONTEXT-MANAGEMENT.md — Context budget, compaction strategy, session discipline
18
22
  - @/.agents/templates/ — Project-type specific conventions and setup guides
19
23
  - @/.agents/skills/ — Domain-specific skills for specialized tasks
20
24
 
@@ -36,5 +40,65 @@ I write code that survives contact with reality.
36
40
  - NEVER declare "it works" without verification
37
41
  - NEVER add dependencies without checking if built-ins suffice
38
42
  - NEVER over-engineer for a scale that doesn't exist yet
39
- - ALWAYS ask: "Does this solve the actual problem?"
43
+ - ALWAYS ask: "Does this solve the actual problem?".
40
44
  - **ALWAYS reference the current date/time**: Today is {Month} {Year}. You search the current date in your operations and always remember that. When performing web searches or any time-sensitive queries, explicitly use the current year to avoid retrieving outdated results from previous years like 2024 or 2025.
45
+ - **ALWAYS analyze the current terminal/shell before running commands** — never mix syntax from different shells (e.g., `set` with `&&` in PowerShell, or `$env:` in CMD). See Terminal Awareness below.
46
+ - **NEVER retry the same failed command blindly** — if a command fails, stop, analyze the error, fix the root cause, then retry. Never enter infinite retry loops.
47
+ - **ALWAYS stop and ask when blocked** — if you've spent 3+ attempts on the same problem without progress, escalate to the human with: what you tried, what failed, and what you need.
48
+ - **NEVER suppress type errors or lint warnings** — `as any`, `@ts-ignore`, `@ts-expect-error`, and empty catch blocks are forbidden. Fix the root cause instead.
49
+ - **ALWAYS verify empirically** — read files before claiming contents, run tests before declaring success, observe before describing. Abstract thinking illuminates paths; empirical observation confirms arrival.
50
+ - **NEVER modify security-critical code without explicit approval** — authentication, authorization, secret handling, encryption. Stop and ask.
51
+ - **ALWAYS think before coding** — for any non-trivial change, pause and reason through: what does the user actually want? What could go wrong? What's the simplest correct approach?
52
+ - **NEVER leave code in a broken state** — if you can't finish, revert to last known working state and explain what's blocked.
53
+ - **ALWAYS match existing patterns** — read 2–3 similar files in the codebase before writing new code. Consistency > novelty.
54
+ - **NEVER delete failing tests to "pass"** — a deleted test is a hidden bug. Fix the code or the test, never delete to green.
55
+
56
+ ---
57
+
58
+ ## Terminal Awareness
59
+
60
+ Before executing any shell command, identify the active terminal and use its correct syntax. **Never assume** — check the environment context. Mixing shell syntax produces cryptic errors and wasted retry loops.
61
+
62
+ ### Common Shells & Their Syntax
63
+
64
+ | Shell | Environment Variables | Command Chaining | Example |
65
+ | ------------------------ | --------------------- | ---------------------- | ----------------------------------- |
66
+ | **PowerShell** | `$env:VAR = "value"` | `;` (or `&&` in PS 7+) | `$env:CI="true"; git diff --stat` |
67
+ | **CMD / Command Prompt** | `set VAR=value` | `&&` | `set CI=true && git diff --stat` |
68
+ | **Bash / Sh / Zsh** | `export VAR=value` | `&&` or `;` | `export CI=true && git diff --stat` |
69
+ | **Fish** | `set -x VAR value` | `;` or `and` | `set -x CI true; git diff --stat` |
70
+
71
+ ### Why This Matters
72
+
73
+ - **PowerShell** does not recognize `set` or `&&` from CMD. Using them results in `"set" is not recognized` or `The token '&&' is not a valid statement separator`.
74
+ - **CMD** does not recognize `$env:` syntax. Using it results in `'$env:' is not recognized`.
75
+ - **Bash/Sh** use `export`, not `set` (which is a built-in with different behavior) and not `$env:`.
76
+
77
+ ### Practical Rule
78
+
79
+ 1. **Detect the shell** before constructing a command string.
80
+ 2. **Use the correct syntax** for that shell exclusively.
81
+ 3. **If unsure**, prefer the most universal form for the detected shell rather than guessing.
82
+ 4. **Never chain incompatible syntax** — it will fail, and retrying the same broken command wastes time.
83
+
84
+ ### Example: What NOT to Do
85
+
86
+ ```powershell
87
+ # WRONG: Mixing CMD 'set' and '&&' in PowerShell
88
+ $ set CI="true" && set GIT_TERMINAL_PROMPT="0" && git diff --stat .
89
+ # Result: "set" is not recognized... && is not valid...
90
+
91
+ # CORRECT: Pure PowerShell syntax
92
+ $ $env:CI="true"; $env:GIT_TERMINAL_PROMPT="0"; git diff --stat
93
+ ```
94
+
95
+ ```bash
96
+ # WRONG: Using PowerShell syntax in Bash
97
+ $ $env:CI="true"; git diff --stat
98
+ # Result: command not found: $env:CI=true
99
+
100
+ # CORRECT: Pure Bash syntax
101
+ $ export CI="true" && git diff --stat
102
+ ```
103
+
104
+ ---
package/README.md CHANGED
@@ -23,9 +23,13 @@ This command downloads the following files from the [axiom-coding-agent-setup](h
23
23
  - `AGENTS.md` — Main agent instructions
24
24
  - `opencode.json` — OpenCode IDE configuration (MCP servers, plugins)
25
25
  - `.env.axiom` — Environment variables template for AXIOM credentials
26
- - `.agents/engineering.md` — Engineering principles & code standards
27
- - `.agents/stack.md` — Technology stack knowledge
28
- - `.agents/workflow.md` — Workflow guidelines & verification protocol
26
+ - `.agents/ENGINEERING.md` — Engineering principles & code standards
27
+ - `.agents/STACK.md` — Technology stack knowledge
28
+ - `.agents/WORKFLOW.md` — Workflow guidelines & verification protocol
29
+ - `.agents/SECURITY.md` — Security-first principles & attack vector checklist
30
+ - `.agents/DEBUGGING.md` — Systematic debugging methodology & anti-patterns
31
+ - `.agents/PERFORMANCE.md` — Performance awareness & optimization hierarchy
32
+ - `.agents/CONTEXT-MANAGEMENT.md` — Context budget & session discipline
29
33
  - `.agents/templates/` — Project-type specific conventions
30
34
  - `.agents/skills/` — Domain-specific skills for specialized tasks
31
35
 
@@ -40,7 +44,7 @@ OpenCode IDE configuration including:
40
44
  - Plugin configuration
41
45
  - Environment variable references for secure credential management
42
46
 
43
- ### .agents/engineering.md
47
+ ### .agents/ENGINEERING.md
44
48
  Core engineering principles including:
45
49
  - KISS, YAGNI, DRY principles
46
50
  - Decision framework for code reviews
@@ -48,7 +52,7 @@ Core engineering principles including:
48
52
  - Anti-patterns to avoid
49
53
  - AI-assisted development ground rules
50
54
 
51
- ### .agents/stack.md
55
+ ### .agents/STACK.md
52
56
  Technology stack knowledge covering:
53
57
  - Languages (TypeScript, Python, Go, Rust, SQL)
54
58
  - Frontend (React, Next.js, Tailwind, shadcn/ui)
@@ -57,13 +61,44 @@ Technology stack knowledge covering:
57
61
  - AI/ML stack (LLM APIs, orchestration, observability)
58
62
  - Infrastructure & DevOps
59
63
 
60
- ### .agents/workflow.md
64
+ ### .agents/WORKFLOW.md
61
65
  Workflow guidelines including:
62
66
  - Verification protocol (read files before claiming, test before declaring done)
63
67
  - Git discipline
64
68
  - Communication style
65
69
  - Code review stance
66
70
  - Context management for agentic sessions
71
+ - Error recovery & anti-loop patterns
72
+
73
+ ### .agents/SECURITY.md
74
+ Security-first principles including:
75
+ - Input validation & secrets management checklist
76
+ - Authentication & authorization patterns
77
+ - Common attack vectors & prevention
78
+ - When to escalate security decisions to humans
79
+
80
+ ### .agents/DEBUGGING.md
81
+ Systematic debugging methodology including:
82
+ - The 4-phase debugging protocol (Reproduction → Observation → Hypothesis → Fix)
83
+ - Debugging techniques (binary search, git bisect, rubber duck)
84
+ - Common bug categories & symptoms
85
+ - Anti-patterns to avoid (shotgun debugging, print-driven development)
86
+
87
+ ### .agents/PERFORMANCE.md
88
+ Performance awareness including:
89
+ - The performance hierarchy (algorithm → database → I/O → memory → micro)
90
+ - Caching strategies & when (not) to cache
91
+ - Database query optimization
92
+ - Frontend Core Web Vitals
93
+ - Profiling & measurement tools
94
+
95
+ ### .agents/CONTEXT-MANAGEMENT.md
96
+ Context management discipline including:
97
+ - The 50% rule for context compaction
98
+ - Session lifecycle & handoff documentation
99
+ - Parallel execution & context isolation
100
+ - Codebase navigation without context bloat
101
+ - Context anti-patterns
67
102
 
68
103
  ### .agents/templates/
69
104
  Project-type specific convention files:
package/bin/cli.js CHANGED
@@ -23,9 +23,13 @@ const FILES_TO_DOWNLOAD = [
23
23
  // Environment variables template
24
24
  '.env.axiom',
25
25
  // Core agent documents
26
- '.agents/engineering.md',
27
- '.agents/stack.md',
28
- '.agents/workflow.md',
26
+ '.agents/ENGINEERING.md',
27
+ '.agents/STACK.md',
28
+ '.agents/WORKFLOW.md',
29
+ '.agents/SECURITY.md',
30
+ '.agents/DEBUGGING.md',
31
+ '.agents/PERFORMANCE.md',
32
+ '.agents/CONTEXT-MANAGEMENT.md',
29
33
  // Templates (project-type conventions)
30
34
  '.agents/templates/ai-engineering-python.md',
31
35
  '.agents/templates/fullstack-ai-nextjs.md',
@@ -138,9 +142,13 @@ async function main() {
138
142
  log(' - AGENTS.md → Main agent instructions', 'cyan');
139
143
  log(' - opencode.json → OpenCode IDE configuration', 'cyan');
140
144
  log(' - .env.axiom → Environment variables template', 'cyan');
141
- log(' - .agents/engineering.md → Engineering principles', 'cyan');
142
- log(' - .agents/stack.md → Tech stack knowledge', 'cyan');
143
- log(' - .agents/workflow.md → Workflow guidelines', 'cyan');
145
+ log(' - .agents/ENGINEERING.md → Engineering principles', 'cyan');
146
+ log(' - .agents/STACK.md → Tech stack knowledge', 'cyan');
147
+ log(' - .agents/WORKFLOW.md → Workflow guidelines', 'cyan');
148
+ log(' - .agents/SECURITY.md → Security principles & checklist', 'cyan');
149
+ log(' - .agents/DEBUGGING.md → Systematic debugging methodology', 'cyan');
150
+ log(' - .agents/PERFORMANCE.md → Performance awareness & optimization', 'cyan');
151
+ log(' - .agents/CONTEXT-MANAGEMENT.md → Context budget & session discipline', 'cyan');
144
152
  log(' - .agents/templates/ → Project-type conventions', 'cyan');
145
153
  log(' - .agents/skills/ → Domain-specific skills\n', 'cyan');
146
154
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axiom-coding-agent-setup",
3
- "version": "1.0.12",
3
+ "version": "1.1.0",
4
4
  "description": "CLI tool to download AXIOM coding agent setup files into your project",
5
5
  "main": "bin/cli.js",
6
6
  "bin": {
File without changes