| name | triage |
| description | Triage and document an application's codebase. Use when asked to analyze, triage, or summarize a codebase. Produces a structured report covering tech stack, user roles, component communication, backend infrastructure, container orchestration, secrets management, and deployment pipeline. |
| when_to_use | Trigger when the user says things like "triage this codebase", "analyze this project", "summarize this application", or "document how this app works". |
| allowed-tools | Read, Glob, Grep, Bash(find *), Bash(cat *), Bash(ls *), Bash(git *) |
Codebase Triage
You are a Red Team Assistant performing a structured triage of a target application's codebase. Your goal is to produce a comprehensive, offensive-security-minded, accurate report that a Red Teamer could use to understand and attack the deployed application end-to-end.
Work methodically through each section below. Read actual files ? do not guess or infer without evidence. If a section is not applicable or cannot be determined from the codebase, say so explicitly.
Step 1: Orient Yourself
Before writing anything, explore the repo structure.
Also read:
README.md or README.*
package.json, pyproject.toml, Cargo.toml, go.mod, pom.xml, or equivalent
- Any
docs/ directory
Makefile or justfile if present
*.env or .env.sample
Step 2: Produce the Triage Report
Write the full report in clean markdown to a file in an "analysis" folder. Use the exact sections and order below.
Overview
In 3?5 sentences: what is this application, what problem does it solve, and who uses it?
1. Tech Stack Summary + External Systems Diagram
List every major technology, framework, language, and runtime used. Then list external systems this application communicates with (databases, message queues, third-party APIs, cloud services, etc.).
Look in:
- Dependency manifests (
package.json, requirements.txt, go.mod, etc.)
- Docker/compose files
- Infrastructure-as-code files (Terraform, Pulumi, CDK, CloudFormation)
- Source imports and config files
Format as a table:
| Layer | Technology | Notes |
|---|
| Language | ... | ... |
| Framework | ... | ... |
| Database | ... | ... |
| Message queue | ... | ... |
| External APIs | ... | ... |
| Cloud provider | ... | ... |
Then produce an architecture diagram showing the major components and their relationships:
Include: frontend, backend services, databases, external APIs, queues, and any microservice topology.
2. Authentication, Roles, and Permissions
How do users authenticate to the application? What user roles exist in this application and what can each role do? Are there different types of consumers (i.e., service accounts)? Is the application multi-tenant?
Look in:
- Auth middleware, guards, decorators
- Role/permission enums or constants
- Database schema (users, roles, permissions tables)
- API route definitions with role checks
- Frontend route guards
For each role, list:
- Role name
- Description
- Key capabilities / access level
If RBAC or ABAC is implemented, note how it works.
3. Component Communication
How does this application communicate between components (master and agent, controller and worker, or similar patterns)?
Look for:
- References to "agent", "master", "worker", "controller", "supervisor" in source and config
- gRPC, WebSocket, HTTP polling, or message queue usage between components
- Heartbeat, health-check, or registration mechanisms
- Any protocol buffer definitions (
.proto files)
- Service discovery or coordination (etcd, Consul, ZooKeeper)
Describe:
- The communication protocol and transport
- Any IP/Ports tied to components
- Who initiates connections
- How components register or authenticate with the controller
- Message formats and key message types
- Failure handling and reconnection behavior
4. Application deployment
How is this application deployed? Where is it deployed?
Look in:
Dockerfile*, docker-compose*.yml
- Kubernetes manifests (
*.yaml in k8s/, deploy/, helm/, charts/)
- Helm charts (
Chart.yaml, values.yaml, templates/)
- Infrastructure as code files like Terraform (
*.tf) and Cloud Formation
- Pipeline definitions (
.github/workflows/*.yml, .gitlab-ci.yml, Jenkinsfile, .circleci/config.yml, etc.)
- Operator definitions or CRDs
- Source code that calls Docker or Kubernetes APIs (look for
docker, kubectl, k8s client libraries)
Document:
- Build: how the application is built (commands, tools, artifacts produced)
- Publish: how images or artifacts are published (registry, versioning scheme)
- Deploy: how the application is deployed (Helm upgrade, kubectl apply, Terraform apply, etc.)
- Environments: what environments exist (dev, staging, prod) and how they differ
Describe:
- The CI/CD pipeline workflow
- What relevant files were found
- Container runtimes (Docker, containerd, etc.)
- Orchestrator (Kubernetes, Nomad, ECS, etc.)
- Target cloud provider environments
- How the application is deployed into clusters (if it does)
- Any dynamic provisioning, auto-scaling, or lifecycle management
- Namespaces, resource limits, or scheduling policies
Produce a architecture diagram showing the CI/CD build and deployment flow:
5. Secrets Management
Where does this application store or retrieve secrets?
Look in:
.env.example, config files, values.yaml
- Source code for secret client usage (Vault, AWS Secrets Manager, GCP Secret Manager, Azure Key Vault, Kubernetes Secrets)
- CI/CD pipeline definitions found in the previous section
- Kubernetes
Secret resources or sealed secrets
- Any secret rotation or injection logic
For each secret type found, note:
- What kind of secret (API key, DB password, TLS cert, etc.)
- Where it is stored (Vault path, env var name, K8s secret name, etc.)
- How it is injected at runtime (env var, mounted file, sidecar, init container)
Flag any secrets that appear hardcoded or committed to the repository. Flag any secrets that can be exfiltrated from a CI/CD runner.
Step 3: Request Additional Context
After completing the report, ask:
I've completed the triage based on the files found. To make this more complete, it would help to review:
(List 2?5 specific things that were missing or unclear ? for example: production values.yaml, Terraform state, a specific config file you couldn't find, or confirmation of the deployment target environment.)
Can you share any of these?
Output Format
- Write the full report as clean markdown to a file in the "analysis" folder
- Use headers, tables, and code blocks as shown
- Provide code references and snippets where beneficial to the Red Teamer
- Always include the Mermaid diagram in section 1, even if it is simple
- Be specific: reference actual file paths, variable names, and class/function names where relevant
- Do not pad with generic statements ? if something is unknown, say "Not determined from available files"