Maslow Codebase Audit
Systematically audit the Maslow codebase for architecture violations, security issues, dependency problems, and code quality concerns. Run this before commits, after major changes, or when assessing build readiness.
Audit Scopes
| Scope |
What it checks |
full (default) |
All checks below |
security |
Secrets exposure, input validation, encryption usage, env var handling |
architecture |
Boundary rules, layer composition, circular deps, service patterns |
deps |
Unused imports, missing dependencies, version conflicts |
encryption |
E2E encryption wiring — is crypto actually used, or just imported? |
Workflow
- Determine scope from user input (default:
full)
- Run checks for that scope using the procedures below
- Report findings as a structured table with severity levels
- Suggest fixes for any issues found
Check Procedures
Security Audit
Secrets in code — Search for hardcoded tokens, API keys, passwords:
- Grep for patterns:
password, secret, token, apikey, api_key, ANTHROPIC, Bearer
- Exclude:
.env.example, node_modules/, test files, this skill file
- Verify
.env is in .gitignore
- Check git history is clean:
git log --all --oneline -S "ANTHROPIC_API_KEY" -- ':!.env.example'
Input validation — Check all HTTP/WS handlers validate input before processing:
- Read
src/services/AppServer.ts
- Verify REST endpoints validate request body fields
- Verify WebSocket message handlers check
type and required fields
- Flag any
JSON.parse() without try/catch
Env var stripping — Verify ANTHROPIC_API_KEY is stripped from child process env:
- Read ClaudeSession.ts spawn configuration
- Confirm
ANTHROPIC_API_KEY is explicitly deleted from env
Auth — Check bearer token auth is enforced:
- Read AppServer.ts auth middleware
- Verify all routes (except health check) require auth
File permissions — Check .env file permissions:
- Run
ls -la .env and verify it's 600 (owner read/write only)
Architecture Audit
Boundary rules — Verify import paths follow rules:
apps/* files must NOT import from src/
packages/* files must NOT import from src/ or apps/
src/ files must NOT import from apps/
- Grep for violations:
from ["'].*\.\./\.\./src/ in apps/, from ["'].*\.\./\.\./apps/ in src/
Service pattern compliance — Each service in src/services/ should have:
- An exported interface (
<Name>Service)
- A
Context.Tag class
- A
Layer.effect or Layer.scoped implementation
- Read each service file and verify
Layer composition — Read src/index.ts:
- Verify all services are composed
- Verify composition order matches dependency graph
- Flag any service that's defined but not composed
Circular dependencies — Check for import cycles:
- Build a dependency map from import statements
- Flag any cycles
Dependency Audit
- TypeScript strict mode — Verify
strict: true in all tsconfig files
- No
any — Grep for : any and as any (excluding node_modules)
- Unused imports — Run
npx tsc --noEmit and check for unused import warnings
- Lint clean — Run
npx eslint . and report error count
Encryption Audit
- Crypto module status — Read
packages/shared/src/crypto/:
- Is the module complete? (key generation, encrypt, decrypt)
- Is it exported from the package?
- Usage check — Grep for crypto imports across the codebase:
- Is
encrypt() called before storing messages?
- Is
decrypt() called when reading messages?
- Are keys generated and stored securely?
- Gap analysis — If crypto exists but isn't wired:
- Identify exactly where encryption should be added
- List the files and functions that need modification
Report Format
## Maslow Audit Report — <scope>
### Summary
- Checks passed: X/Y
- Issues found: Z (N critical, M warning, K info)
### Findings
| # | Severity | Category | Finding | Location | Fix |
|---|----------|----------|---------|----------|-----|
| 1 | CRITICAL | Security | Hardcoded token found | file:line | Remove and use env var |
| 2 | WARNING | Architecture | Boundary violation | file:line | Change import path |
| 3 | INFO | Deps | Unused import | file:line | Remove import |
### Recommendations
1. ...
2. ...
Severity Levels
| Level |
Meaning |
| CRITICAL |
Security vulnerability, data exposure risk, or broken functionality |
| WARNING |
Architecture violation, code smell, or potential future issue |
| INFO |
Style issue, minor improvement, or observation |
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: maslow-audit3description: Run architecture, security, and code quality audits on the Maslow codebase. Use when reviewing changes before commit, checking for security issues, validating boundary rules, or assessing build readiness. Invoke with /maslow-audit [scope] where scope is one of full, security, architecture, deps, or encryption. Use when this capability is needed.4---56# Maslow Codebase Audit78Systematically audit the Maslow codebase for architecture violations, security issues, dependency problems, and code quality concerns. Run this before commits, after major changes, or when assessing build readiness.910## Audit Scopes1112| Scope | What it checks |13|-------|---------------|14| `full` (default) | All checks below |15| `security` | Secrets exposure, input validation, encryption usage, env var handling |16| `architecture` | Boundary rules, layer composition, circular deps, service patterns |17| `deps` | Unused imports, missing dependencies, version conflicts |18| `encryption` | E2E encryption wiring — is crypto actually used, or just imported? |1920## Workflow21221. **Determine scope** from user input (default: `full`)232. **Run checks** for that scope using the procedures below243. **Report findings** as a structured table with severity levels254. **Suggest fixes** for any issues found2627## Check Procedures2829### Security Audit30311. **Secrets in code** — Search for hardcoded tokens, API keys, passwords:32 - Grep for patterns: `password`, `secret`, `token`, `apikey`, `api_key`, `ANTHROPIC`, `Bearer`33 - Exclude: `.env.example`, `node_modules/`, test files, this skill file34 - Verify `.env` is in `.gitignore`35 - Check git history is clean: `git log --all --oneline -S "ANTHROPIC_API_KEY" -- ':!.env.example'`36372. **Input validation** — Check all HTTP/WS handlers validate input before processing:38 - Read `src/services/AppServer.ts`39 - Verify REST endpoints validate request body fields40 - Verify WebSocket message handlers check `type` and required fields41 - Flag any `JSON.parse()` without try/catch42433. **Env var stripping** — Verify ANTHROPIC_API_KEY is stripped from child process env:44 - Read ClaudeSession.ts spawn configuration45 - Confirm `ANTHROPIC_API_KEY` is explicitly deleted from env46474. **Auth** — Check bearer token auth is enforced:48 - Read AppServer.ts auth middleware49 - Verify all routes (except health check) require auth50515. **File permissions** — Check `.env` file permissions:52 - Run `ls -la .env` and verify it's `600` (owner read/write only)5354### Architecture Audit55561. **Boundary rules** — Verify import paths follow rules:57 - `apps/*` files must NOT import from `src/`58 - `packages/*` files must NOT import from `src/` or `apps/`59 - `src/` files must NOT import from `apps/`60 - Grep for violations: `from ["'].*\.\./\.\./src/` in apps/, `from ["'].*\.\./\.\./apps/` in src/61622. **Service pattern compliance** — Each service in `src/services/` should have:63 - An exported interface (`<Name>Service`)64 - A `Context.Tag` class65 - A `Layer.effect` or `Layer.scoped` implementation66 - Read each service file and verify67683. **Layer composition** — Read `src/index.ts`:69 - Verify all services are composed70 - Verify composition order matches dependency graph71 - Flag any service that's defined but not composed72734. **Circular dependencies** — Check for import cycles:74 - Build a dependency map from import statements75 - Flag any cycles7677### Dependency Audit78791. **TypeScript strict mode** — Verify `strict: true` in all tsconfig files802. **No `any`** — Grep for `: any` and `as any` (excluding node_modules)813. **Unused imports** — Run `npx tsc --noEmit` and check for unused import warnings824. **Lint clean** — Run `npx eslint .` and report error count8384### Encryption Audit85861. **Crypto module status** — Read `packages/shared/src/crypto/`:87 - Is the module complete? (key generation, encrypt, decrypt)88 - Is it exported from the package?892. **Usage check** — Grep for crypto imports across the codebase:90 - Is `encrypt()` called before storing messages?91 - Is `decrypt()` called when reading messages?92 - Are keys generated and stored securely?933. **Gap analysis** — If crypto exists but isn't wired:94 - Identify exactly where encryption should be added95 - List the files and functions that need modification9697## Report Format9899```100## Maslow Audit Report — <scope>101102### Summary103- Checks passed: X/Y104- Issues found: Z (N critical, M warning, K info)105106### Findings107108| # | Severity | Category | Finding | Location | Fix |109|---|----------|----------|---------|----------|-----|110| 1 | CRITICAL | Security | Hardcoded token found | file:line | Remove and use env var |111| 2 | WARNING | Architecture | Boundary violation | file:line | Change import path |112| 3 | INFO | Deps | Unused import | file:line | Remove import |113114### Recommendations1151. ...1162. ...117```118119## Severity Levels120121| Level | Meaning |122|-------|---------|123| CRITICAL | Security vulnerability, data exposure risk, or broken functionality |124| WARNING | Architecture violation, code smell, or potential future issue |125| INFO | Style issue, minor improvement, or observation |126127---128> Converted and distributed by [TomeVault](https://tomevault.io/claim/twlines) — claim your Tome and manage your conversions.129<!-- tomevault:4.0:skill_md:2026-04-15 -->