diff --git a/.agents/skills/Ai-hack-simulation/SKILL.md b/.agents/skills/Ai-hack-simulation/SKILL.md new file mode 100644 index 0000000..a815cb3 --- /dev/null +++ b/.agents/skills/Ai-hack-simulation/SKILL.md @@ -0,0 +1,118 @@ +```markdown +# Ai-hack-simulation Development Patterns + +> Auto-generated skill from repository analysis + +## Overview +This skill introduces the core development patterns, coding conventions, and operational workflows used in the `Ai-hack-simulation` Python repository. It covers file organization, code style, commit practices, and step-by-step instructions for key maintenance workflows such as funding updates and Dockerfile security hardening. This guide is designed to help contributors quickly align with the project's standards and automation. + +## Coding Conventions + +### File Naming +- **Convention:** camelCase +- **Example:** + ```plaintext + aiAgent.py + dataProcessor.py + ``` + +### Import Style +- **Convention:** Relative imports are preferred. +- **Example:** + ```python + from .utils import helperFunction + from .models import SimulationModel + ``` + +### Export Style +- **Convention:** Named exports (explicitly listing exported classes/functions). +- **Example:** + ```python + __all__ = ['SimulationModel', 'runSimulation'] + ``` + +### Commit Patterns +- **Types:** Mixed (features, fixes, chores, docs, security) +- **Prefixes:** `chore`, `security`, `docs`, `fix`, `feat` +- **Example:** + ``` + feat: add support for multi-agent simulation + fix: correct agent movement logic + docs: update README with usage examples + ``` + +## Workflows + +### Update Funding Configuration +**Trigger:** When someone wants to change or add funding sources or sponsorship information. +**Command:** `/update-funding` + +1. Edit `.github/FUNDING.yml` with new or updated funding entries. +2. Commit and push the changes. + +**Example:** +```yaml +# .github/FUNDING.yml +github: [your-github-username] +patreon: your-patreon-id +``` + +--- + +### Dockerfile Security Hardening +**Trigger:** When someone wants to address security vulnerabilities or optimize Docker builds. +**Command:** `/harden-dockerfile` + +1. Edit `Dockerfile` to improve security or optimize the build process. +2. Optionally update `.trivyignore` to suppress known CVEs. +3. Commit and push the changes. + +**Example:** +```dockerfile +# Dockerfile +FROM python:3.11-slim +RUN pip install --no-cache-dir -r requirements.txt +USER nobody +``` +```plaintext +# .trivyignore +CVE-2023-12345 +``` + +--- + +### Suppress CVE in Trivyignore +**Trigger:** When someone wants to temporarily ignore specific CVEs during security scans. +**Command:** `/suppress-cve` + +1. Edit `.trivyignore` to add or update CVE entries. +2. Commit and push the changes. + +**Example:** +```plaintext +# .trivyignore +CVE-2023-12345 +CVE-2024-67890 +``` + +--- + +## Testing Patterns + +- **Framework:** Unknown (not explicitly detected) +- **File Pattern:** Test files are named using the pattern `*.test.*` +- **Example:** + ```plaintext + agentLogic.test.py + simulationRunner.test.py + ``` +- **Note:** Ensure new tests follow this naming convention for consistency. + +## Commands + +| Command | Purpose | +|---------------------|--------------------------------------------------------------| +| /update-funding | Update project funding and sponsorship configuration | +| /harden-dockerfile | Apply security improvements or optimizations to Dockerfile | +| /suppress-cve | Suppress specific CVEs in vulnerability scans via Trivyignore| +``` diff --git a/.agents/skills/Ai-hack-simulation/agents/openai.yaml b/.agents/skills/Ai-hack-simulation/agents/openai.yaml new file mode 100644 index 0000000..c300f9c --- /dev/null +++ b/.agents/skills/Ai-hack-simulation/agents/openai.yaml @@ -0,0 +1,6 @@ +interface: + display_name: "Ai Hack Simulation" + short_description: "Repo-specific patterns and workflows for Ai-hack-simulation" + default_prompt: "Use the Ai-hack-simulation repo skill to follow existing architecture, testing, and workflow conventions." +policy: + allow_implicit_invocation: true \ No newline at end of file diff --git a/.claude/commands/dockerfile-security-hardening.md b/.claude/commands/dockerfile-security-hardening.md new file mode 100644 index 0000000..6f9975d --- /dev/null +++ b/.claude/commands/dockerfile-security-hardening.md @@ -0,0 +1,36 @@ +--- +name: dockerfile-security-hardening +description: Workflow command scaffold for dockerfile-security-hardening in Ai-hack-simulation. +allowed_tools: ["Bash", "Read", "Write", "Grep", "Glob"] +--- + +# /dockerfile-security-hardening + +Use this workflow when working on **dockerfile-security-hardening** in `Ai-hack-simulation`. + +## Goal + +Improves Dockerfile security or optimizes build process, often in response to CVEs. + +## Common Files + +- `Dockerfile` +- `.trivyignore` + +## Suggested Sequence + +1. Understand the current state and failure mode before editing. +2. Make the smallest coherent change that satisfies the workflow goal. +3. Run the most relevant verification for touched files. +4. Summarize what changed and what still needs review. + +## Typical Commit Signals + +- Edit Dockerfile to improve security or build process. +- Optionally update .trivyignore to suppress known CVEs. +- Commit and push the changes. + +## Notes + +- Treat this as a scaffold, not a hard-coded script. +- Update the command if the workflow evolves materially. \ No newline at end of file diff --git a/.claude/commands/suppress-cve-in-trivyignore.md b/.claude/commands/suppress-cve-in-trivyignore.md new file mode 100644 index 0000000..17e6e21 --- /dev/null +++ b/.claude/commands/suppress-cve-in-trivyignore.md @@ -0,0 +1,34 @@ +--- +name: suppress-cve-in-trivyignore +description: Workflow command scaffold for suppress-cve-in-trivyignore in Ai-hack-simulation. +allowed_tools: ["Bash", "Read", "Write", "Grep", "Glob"] +--- + +# /suppress-cve-in-trivyignore + +Use this workflow when working on **suppress-cve-in-trivyignore** in `Ai-hack-simulation`. + +## Goal + +Suppresses known CVEs in vulnerability scanning by updating .trivyignore. + +## Common Files + +- `.trivyignore` + +## Suggested Sequence + +1. Understand the current state and failure mode before editing. +2. Make the smallest coherent change that satisfies the workflow goal. +3. Run the most relevant verification for touched files. +4. Summarize what changed and what still needs review. + +## Typical Commit Signals + +- Edit .trivyignore to add or update CVE entries. +- Commit and push the changes. + +## Notes + +- Treat this as a scaffold, not a hard-coded script. +- Update the command if the workflow evolves materially. \ No newline at end of file diff --git a/.claude/commands/update-funding-configuration.md b/.claude/commands/update-funding-configuration.md new file mode 100644 index 0000000..871840b --- /dev/null +++ b/.claude/commands/update-funding-configuration.md @@ -0,0 +1,34 @@ +--- +name: update-funding-configuration +description: Workflow command scaffold for update-funding-configuration in Ai-hack-simulation. +allowed_tools: ["Bash", "Read", "Write", "Grep", "Glob"] +--- + +# /update-funding-configuration + +Use this workflow when working on **update-funding-configuration** in `Ai-hack-simulation`. + +## Goal + +Updates project funding and sponsorship details. + +## Common Files + +- `.github/FUNDING.yml` + +## Suggested Sequence + +1. Understand the current state and failure mode before editing. +2. Make the smallest coherent change that satisfies the workflow goal. +3. Run the most relevant verification for touched files. +4. Summarize what changed and what still needs review. + +## Typical Commit Signals + +- Edit .github/FUNDING.yml with new or updated funding entries. +- Commit and push the changes. + +## Notes + +- Treat this as a scaffold, not a hard-coded script. +- Update the command if the workflow evolves materially. \ No newline at end of file diff --git a/.claude/ecc-tools.json b/.claude/ecc-tools.json new file mode 100644 index 0000000..d48c567 --- /dev/null +++ b/.claude/ecc-tools.json @@ -0,0 +1,320 @@ +{ + "version": "1.3", + "schemaVersion": "1.0", + "generatedBy": "ecc-tools", + "generatedAt": "2026-07-23T03:52:19.970Z", + "repo": "https://github.com/devops2626/Ai-hack-simulation", + "referenceSetReadiness": { + "score": 14, + "present": 1, + "total": 7, + "items": [ + { + "id": "deep-analyzer-corpus", + "label": "Deep analyzer corpus", + "status": "missing", + "evidence": [], + "recommendation": "Add analyzer fixture, golden, benchmark, or reference-set files that can catch analyzer regressions." + }, + { + "id": "rag-evaluator", + "label": "RAG/evaluator comparison", + "status": "missing", + "evidence": [], + "recommendation": "Add retrieval or evaluator reference-set comparison fixtures with expected ranking behavior." + }, + { + "id": "pr-salvage", + "label": "PR salvage/review corpus", + "status": "missing", + "evidence": [], + "recommendation": "Add stale-PR, review-thread, reopen-flow, or salvage reference cases for queue cleanup automation." + }, + { + "id": "discussion-triage", + "label": "Discussion triage corpus", + "status": "missing", + "evidence": [], + "recommendation": "Add public discussion triage fixtures, golden cases, or reference sets for informational, answered, and no-response classifications." + }, + { + "id": "harness-compatibility", + "label": "Harness compatibility", + "status": "missing", + "evidence": [], + "recommendation": "Add cross-harness, adapter-compliance, or harness-audit evidence for Claude, Codex, OpenCode, Zed, dmux, and agent surfaces." + }, + { + "id": "security-evidence", + "label": "Security evidence", + "status": "present", + "evidence": [ + ".github/workflows/security.yml", + "SECURITY-MITIGATION.md" + ], + "recommendation": "Attach security evidence such as SBOMs, SARIF, audit reports, or AgentShield evidence packs." + }, + { + "id": "ci-failure-mode", + "label": "CI failure-mode evidence", + "status": "missing", + "evidence": [], + "recommendation": "Add captured CI failure logs, dry-run fixtures, or troubleshooting docs for common workflow failure modes." + } + ] + }, + "profiles": { + "requested": "full", + "recommended": "full", + "effective": "developer", + "requestedAlias": "full", + "recommendedAlias": "full", + "effectiveAlias": "developer" + }, + "requestedProfile": "full", + "profile": "developer", + "recommendedProfile": "full", + "effectiveProfile": "developer", + "tier": "free", + "requestedComponents": [ + "repo-baseline", + "workflow-automation", + "security-audits", + "research-tooling", + "team-rollout", + "governance-controls" + ], + "selectedComponents": [ + "repo-baseline", + "workflow-automation" + ], + "requestedAddComponents": [], + "requestedRemoveComponents": [], + "blockedRemovalComponents": [], + "tierFilteredComponents": [ + "security-audits", + "research-tooling", + "team-rollout", + "governance-controls" + ], + "requestedRootPackages": [ + "runtime-core", + "workflow-pack", + "agentshield-pack", + "research-pack", + "team-config-sync", + "enterprise-controls" + ], + "selectedRootPackages": [ + "runtime-core", + "workflow-pack" + ], + "requestedPackages": [ + "runtime-core", + "workflow-pack", + "agentshield-pack", + "research-pack", + "team-config-sync", + "enterprise-controls" + ], + "requestedAddPackages": [], + "requestedRemovePackages": [], + "selectedPackages": [ + "runtime-core", + "workflow-pack" + ], + "packages": [ + "runtime-core", + "workflow-pack" + ], + "blockedRemovalPackages": [], + "tierFilteredRootPackages": [ + "agentshield-pack", + "research-pack", + "team-config-sync", + "enterprise-controls" + ], + "tierFilteredPackages": [ + "agentshield-pack", + "research-pack", + "team-config-sync", + "enterprise-controls" + ], + "conflictingPackages": [], + "dependencyGraph": { + "runtime-core": [], + "workflow-pack": [ + "runtime-core" + ] + }, + "resolutionOrder": [ + "runtime-core", + "workflow-pack" + ], + "requestedModules": [ + "runtime-core", + "workflow-pack", + "agentshield-pack", + "research-pack", + "team-config-sync", + "enterprise-controls" + ], + "selectedModules": [ + "runtime-core", + "workflow-pack" + ], + "modules": [ + "runtime-core", + "workflow-pack" + ], + "managedFiles": [ + ".claude/skills/Ai-hack-simulation/SKILL.md", + ".agents/skills/Ai-hack-simulation/SKILL.md", + ".agents/skills/Ai-hack-simulation/agents/openai.yaml", + ".claude/identity.json", + ".codex/config.toml", + ".codex/AGENTS.md", + ".codex/agents/explorer.toml", + ".codex/agents/reviewer.toml", + ".codex/agents/docs-researcher.toml", + ".claude/homunculus/instincts/inherited/Ai-hack-simulation-instincts.yaml", + ".claude/commands/update-funding-configuration.md", + ".claude/commands/dockerfile-security-hardening.md", + ".claude/commands/suppress-cve-in-trivyignore.md" + ], + "packageFiles": { + "runtime-core": [ + ".claude/skills/Ai-hack-simulation/SKILL.md", + ".agents/skills/Ai-hack-simulation/SKILL.md", + ".agents/skills/Ai-hack-simulation/agents/openai.yaml", + ".claude/identity.json", + ".codex/config.toml", + ".codex/AGENTS.md", + ".codex/agents/explorer.toml", + ".codex/agents/reviewer.toml", + ".codex/agents/docs-researcher.toml", + ".claude/homunculus/instincts/inherited/Ai-hack-simulation-instincts.yaml" + ], + "workflow-pack": [ + ".claude/commands/update-funding-configuration.md", + ".claude/commands/dockerfile-security-hardening.md", + ".claude/commands/suppress-cve-in-trivyignore.md" + ] + }, + "moduleFiles": { + "runtime-core": [ + ".claude/skills/Ai-hack-simulation/SKILL.md", + ".agents/skills/Ai-hack-simulation/SKILL.md", + ".agents/skills/Ai-hack-simulation/agents/openai.yaml", + ".claude/identity.json", + ".codex/config.toml", + ".codex/AGENTS.md", + ".codex/agents/explorer.toml", + ".codex/agents/reviewer.toml", + ".codex/agents/docs-researcher.toml", + ".claude/homunculus/instincts/inherited/Ai-hack-simulation-instincts.yaml" + ], + "workflow-pack": [ + ".claude/commands/update-funding-configuration.md", + ".claude/commands/dockerfile-security-hardening.md", + ".claude/commands/suppress-cve-in-trivyignore.md" + ] + }, + "files": [ + { + "moduleId": "runtime-core", + "path": ".claude/skills/Ai-hack-simulation/SKILL.md", + "description": "Repository-specific Claude Code skill generated from git history." + }, + { + "moduleId": "runtime-core", + "path": ".agents/skills/Ai-hack-simulation/SKILL.md", + "description": "Codex-facing copy of the generated repository skill." + }, + { + "moduleId": "runtime-core", + "path": ".agents/skills/Ai-hack-simulation/agents/openai.yaml", + "description": "Codex skill metadata so the repo skill appears cleanly in the skill interface." + }, + { + "moduleId": "runtime-core", + "path": ".claude/identity.json", + "description": "Suggested identity.json baseline derived from repository conventions." + }, + { + "moduleId": "runtime-core", + "path": ".codex/config.toml", + "description": "Repo-local Codex MCP and multi-agent baseline aligned with ECC defaults." + }, + { + "moduleId": "runtime-core", + "path": ".codex/AGENTS.md", + "description": "Codex usage guide that points at the generated repo skill and workflow bundle." + }, + { + "moduleId": "runtime-core", + "path": ".codex/agents/explorer.toml", + "description": "Read-only explorer role config for Codex multi-agent work." + }, + { + "moduleId": "runtime-core", + "path": ".codex/agents/reviewer.toml", + "description": "Read-only reviewer role config focused on correctness and security." + }, + { + "moduleId": "runtime-core", + "path": ".codex/agents/docs-researcher.toml", + "description": "Read-only docs researcher role config for API verification." + }, + { + "moduleId": "runtime-core", + "path": ".claude/homunculus/instincts/inherited/Ai-hack-simulation-instincts.yaml", + "description": "Continuous-learning instincts derived from repository patterns." + }, + { + "moduleId": "workflow-pack", + "path": ".claude/commands/update-funding-configuration.md", + "description": "Workflow command scaffold for update-funding-configuration." + }, + { + "moduleId": "workflow-pack", + "path": ".claude/commands/dockerfile-security-hardening.md", + "description": "Workflow command scaffold for dockerfile-security-hardening." + }, + { + "moduleId": "workflow-pack", + "path": ".claude/commands/suppress-cve-in-trivyignore.md", + "description": "Workflow command scaffold for suppress-cve-in-trivyignore." + } + ], + "workflows": [ + { + "command": "update-funding-configuration", + "path": ".claude/commands/update-funding-configuration.md" + }, + { + "command": "dockerfile-security-hardening", + "path": ".claude/commands/dockerfile-security-hardening.md" + }, + { + "command": "suppress-cve-in-trivyignore", + "path": ".claude/commands/suppress-cve-in-trivyignore.md" + } + ], + "adapters": { + "claudeCode": { + "skillPath": ".claude/skills/Ai-hack-simulation/SKILL.md", + "identityPath": ".claude/identity.json", + "commandPaths": [ + ".claude/commands/update-funding-configuration.md", + ".claude/commands/dockerfile-security-hardening.md", + ".claude/commands/suppress-cve-in-trivyignore.md" + ] + }, + "codex": { + "configPath": ".codex/config.toml", + "agentsGuidePath": ".codex/AGENTS.md", + "skillPath": ".agents/skills/Ai-hack-simulation/SKILL.md" + } + } +} \ No newline at end of file diff --git a/.claude/homunculus/instincts/inherited/Ai-hack-simulation-instincts.yaml b/.claude/homunculus/instincts/inherited/Ai-hack-simulation-instincts.yaml new file mode 100644 index 0000000..669a548 --- /dev/null +++ b/.claude/homunculus/instincts/inherited/Ai-hack-simulation-instincts.yaml @@ -0,0 +1,408 @@ +# Instincts generated from https://github.com/devops2626/Ai-hack-simulation +# Generated: 2026-07-23T03:52:34.975Z +# Version: 2.0 +# NOTE: This file supplements (does not replace) any existing curated instincts. +# High-confidence manually curated instincts should be preserved alongside these. + +--- +id: Ai-hack-simulation-commit-length +trigger: "when writing a commit message" +confidence: 0.6 +domain: git +source: repo-analysis +source_repo: https://github.com/devops2626/Ai-hack-simulation +--- + +# Ai Hack Simulation Commit Length + +## Action + +Keep commit messages concise (~46 characters) + +## Evidence + +- Average commit message length: 46 chars +- Based on 19 commits + +--- +id: Ai-hack-simulation-naming-files +trigger: "when creating a new file" +confidence: 0.8 +domain: code-style +source: repo-analysis +source_repo: https://github.com/devops2626/Ai-hack-simulation +--- + +# Ai Hack Simulation Naming Files + +## Action + +Use camelCase naming convention + +## Evidence + +- Analyzed file naming patterns in repository +- Dominant pattern: camelCase + +--- +id: Ai-hack-simulation-import-relative +trigger: "when importing modules" +confidence: 0.75 +domain: code-style +source: repo-analysis +source_repo: https://github.com/devops2626/Ai-hack-simulation +--- + +# Ai Hack Simulation Import Relative + +## Action + +Use relative imports for project files + +## Evidence + +- Import analysis shows relative import pattern +- Example: import { x } from '../lib/x' + +--- +id: Ai-hack-simulation-export-style +trigger: "when exporting from a module" +confidence: 0.7 +domain: code-style +source: repo-analysis +source_repo: https://github.com/devops2626/Ai-hack-simulation +--- + +# Ai Hack Simulation Export Style + +## Action + +Prefer named exports + +## Evidence + +- Export pattern analysis +- Dominant style: named + +--- +id: Ai-hack-simulation-test-separate +trigger: "when writing tests" +confidence: 0.8 +domain: testing +source: repo-analysis +source_repo: https://github.com/devops2626/Ai-hack-simulation +--- + +# Ai Hack Simulation Test Separate + +## Action + +Place tests in the tests/ or __tests__/ directory, mirroring src structure + +## Evidence + +- Separate test directory pattern detected +- Tests live in dedicated test folders + +--- +id: Ai-hack-simulation-workflow-update-funding-configuration +trigger: "when doing update funding configuration" +confidence: 0.65 +domain: workflow +source: repo-analysis +source_repo: https://github.com/devops2626/Ai-hack-simulation +--- + +# Ai Hack Simulation Workflow Update Funding Configuration + +## Action + +Follow the update-funding-configuration workflow: +1. Edit .github/FUNDING.yml with new or updated funding entries. +2. Commit and push the changes. + +## Evidence + +- Workflow detected from commit patterns +- Frequency: ~3x per month +- Files: .github/FUNDING.yml + +--- +id: Ai-hack-simulation-workflow-dockerfile-security-hardening +trigger: "when doing dockerfile security hardening" +confidence: 0.65 +domain: workflow +source: repo-analysis +source_repo: https://github.com/devops2626/Ai-hack-simulation +--- + +# Ai Hack Simulation Workflow Dockerfile Security Hardening + +## Action + +Follow the dockerfile-security-hardening workflow: +1. Edit Dockerfile to improve security or build process. +2. Optionally update .trivyignore to suppress known CVEs. +3. Commit and push the changes. + +## Evidence + +- Workflow detected from commit patterns +- Frequency: ~3x per month +- Files: Dockerfile, .trivyignore + +--- +id: Ai-hack-simulation-workflow-suppress-cve-in-trivyignore +trigger: "when doing suppress cve in trivyignore" +confidence: 0.65 +domain: workflow +source: repo-analysis +source_repo: https://github.com/devops2626/Ai-hack-simulation +--- + +# Ai Hack Simulation Workflow Suppress Cve In Trivyignore + +## Action + +Follow the suppress-cve-in-trivyignore workflow: +1. Edit .trivyignore to add or update CVE entries. +2. Commit and push the changes. + +## Evidence + +- Workflow detected from commit patterns +- Frequency: ~3x per month +- Files: .trivyignore + +--- +id: ai-hack-simulation-instinct-file-naming +trigger: "When creating new Python files" +confidence: 0.8 +domain: code-style +source: repo-analysis +source_repo: devops2626/Ai-hack-simulation +--- + +# Ai Hack Simulation Instinct File Naming + +## Action + +Name files using camelCase convention + +## Evidence + +- Pattern in namingConventions.files: camelCase + +--- +id: ai-hack-simulation-instinct-function-naming +trigger: "When defining new Python functions" +confidence: 0.8 +domain: code-style +source: repo-analysis +source_repo: devops2626/Ai-hack-simulation +--- + +# Ai Hack Simulation Instinct Function Naming + +## Action + +Name functions using camelCase convention + +## Evidence + +- Pattern in namingConventions.functions: camelCase + +--- +id: ai-hack-simulation-instinct-class-naming +trigger: "When defining new Python classes" +confidence: 0.8 +domain: code-style +source: repo-analysis +source_repo: devops2626/Ai-hack-simulation +--- + +# Ai Hack Simulation Instinct Class Naming + +## Action + +Name classes using PascalCase convention + +## Evidence + +- Pattern in namingConventions.classes: PascalCase + +--- +id: ai-hack-simulation-instinct-constant-naming +trigger: "When defining constants in Python code" +confidence: 0.8 +domain: code-style +source: repo-analysis +source_repo: devops2626/Ai-hack-simulation +--- + +# Ai Hack Simulation Instinct Constant Naming + +## Action + +Name constants using SCREAMING_SNAKE_CASE convention + +## Evidence + +- Pattern in namingConventions.constants: SCREAMING_SNAKE_CASE + +--- +id: ai-hack-simulation-instinct-import-style +trigger: "When importing modules in Python code" +confidence: 0.7 +domain: code-style +source: repo-analysis +source_repo: devops2626/Ai-hack-simulation +--- + +# Ai Hack Simulation Instinct Import Style + +## Action + +Use relative import style + +## Evidence + +- Pattern in importStyle: relative + +--- +id: ai-hack-simulation-instinct-export-style +trigger: "When exporting functions or classes from modules" +confidence: 0.7 +domain: code-style +source: repo-analysis +source_repo: devops2626/Ai-hack-simulation +--- + +# Ai Hack Simulation Instinct Export Style + +## Action + +Use named exports + +## Evidence + +- Pattern in exportStyle: named + +--- +id: ai-hack-simulation-instinct-test-location +trigger: "When adding or updating tests" +confidence: 0.8 +domain: testing +source: repo-analysis +source_repo: devops2626/Ai-hack-simulation +--- + +# Ai Hack Simulation Instinct Test Location + +## Action + +Place tests in a separate directory from source code + +## Evidence + +- Pattern in architecture.testLocation: separate + +--- +id: ai-hack-simulation-instinct-commit-prefix +trigger: "When writing a commit message" +confidence: 0.9 +domain: git +source: repo-analysis +source_repo: devops2626/Ai-hack-simulation +--- + +# Ai Hack Simulation Instinct Commit Prefix + +## Action + +Begin commit message with a type prefix (e.g., chore, security, docs, fix, feat) + +## Evidence + +- Pattern in commits.prefixes: chore, security, docs, fix, feat +- Seen in commit: 'fix: suppress CVE-2026-8376 until Debian upstream patches perl-base' + +--- +id: ai-hack-simulation-instinct-commit-length +trigger: "When composing a commit message" +confidence: 0.6 +domain: git +source: repo-analysis +source_repo: devops2626/Ai-hack-simulation +--- + +# Ai Hack Simulation Instinct Commit Length + +## Action + +Keep commit message concise, around 46 characters on average + +## Evidence + +- Pattern in commits.averageLength: 46 + +--- +id: ai-hack-simulation-instinct-update-funding +trigger: "When someone wants to change or add funding sources or sponsorship information" +confidence: 0.95 +domain: workflow +source: repo-analysis +source_repo: devops2626/Ai-hack-simulation +--- + +# Ai Hack Simulation Instinct Update Funding + +## Action + +Edit .github/FUNDING.yml and commit the changes + +## Evidence + +- Workflow: update-funding-configuration +- Seen in commit: 'Update FUNDING.yml' + +--- +id: ai-hack-simulation-instinct-dockerfile-security +trigger: "When someone wants to address security vulnerabilities or optimize Docker builds" +confidence: 0.9 +domain: workflow +source: repo-analysis +source_repo: devops2626/Ai-hack-simulation +--- + +# Ai Hack Simulation Instinct Dockerfile Security + +## Action + +Edit Dockerfile to improve security or build process and optionally update .trivyignore to suppress known CVEs, then commit the changes + +## Evidence + +- Workflow: dockerfile-security-hardening +- Seen in commit: 'chore: force linux/amd64 platform for builder and runtime to avoid 32-bit perl CVE-2026-8376' + +--- +id: ai-hack-simulation-instinct-suppress-cve +trigger: "When someone wants to temporarily ignore specific CVEs during security scans" +confidence: 0.9 +domain: workflow +source: repo-analysis +source_repo: devops2626/Ai-hack-simulation +--- + +# Ai Hack Simulation Instinct Suppress Cve + +## Action + +Edit .trivyignore to add or update CVE entries and commit the changes + +## Evidence + +- Workflow: suppress-cve-in-trivyignore +- Seen in commit: 'fix: suppress CVE-2026-8376 until Debian upstream patches perl-base' + diff --git a/.claude/identity.json b/.claude/identity.json new file mode 100644 index 0000000..d2040a9 --- /dev/null +++ b/.claude/identity.json @@ -0,0 +1,14 @@ +{ + "version": "2.0", + "technicalLevel": "technical", + "preferredStyle": { + "verbosity": "moderate", + "codeComments": true, + "explanations": true + }, + "domains": [ + "python" + ], + "suggestedBy": "ecc-tools-repo-analysis", + "createdAt": "2026-07-23T03:52:34.975Z" +} \ No newline at end of file diff --git a/.claude/skills/Ai-hack-simulation/SKILL.md b/.claude/skills/Ai-hack-simulation/SKILL.md new file mode 100644 index 0000000..a815cb3 --- /dev/null +++ b/.claude/skills/Ai-hack-simulation/SKILL.md @@ -0,0 +1,118 @@ +```markdown +# Ai-hack-simulation Development Patterns + +> Auto-generated skill from repository analysis + +## Overview +This skill introduces the core development patterns, coding conventions, and operational workflows used in the `Ai-hack-simulation` Python repository. It covers file organization, code style, commit practices, and step-by-step instructions for key maintenance workflows such as funding updates and Dockerfile security hardening. This guide is designed to help contributors quickly align with the project's standards and automation. + +## Coding Conventions + +### File Naming +- **Convention:** camelCase +- **Example:** + ```plaintext + aiAgent.py + dataProcessor.py + ``` + +### Import Style +- **Convention:** Relative imports are preferred. +- **Example:** + ```python + from .utils import helperFunction + from .models import SimulationModel + ``` + +### Export Style +- **Convention:** Named exports (explicitly listing exported classes/functions). +- **Example:** + ```python + __all__ = ['SimulationModel', 'runSimulation'] + ``` + +### Commit Patterns +- **Types:** Mixed (features, fixes, chores, docs, security) +- **Prefixes:** `chore`, `security`, `docs`, `fix`, `feat` +- **Example:** + ``` + feat: add support for multi-agent simulation + fix: correct agent movement logic + docs: update README with usage examples + ``` + +## Workflows + +### Update Funding Configuration +**Trigger:** When someone wants to change or add funding sources or sponsorship information. +**Command:** `/update-funding` + +1. Edit `.github/FUNDING.yml` with new or updated funding entries. +2. Commit and push the changes. + +**Example:** +```yaml +# .github/FUNDING.yml +github: [your-github-username] +patreon: your-patreon-id +``` + +--- + +### Dockerfile Security Hardening +**Trigger:** When someone wants to address security vulnerabilities or optimize Docker builds. +**Command:** `/harden-dockerfile` + +1. Edit `Dockerfile` to improve security or optimize the build process. +2. Optionally update `.trivyignore` to suppress known CVEs. +3. Commit and push the changes. + +**Example:** +```dockerfile +# Dockerfile +FROM python:3.11-slim +RUN pip install --no-cache-dir -r requirements.txt +USER nobody +``` +```plaintext +# .trivyignore +CVE-2023-12345 +``` + +--- + +### Suppress CVE in Trivyignore +**Trigger:** When someone wants to temporarily ignore specific CVEs during security scans. +**Command:** `/suppress-cve` + +1. Edit `.trivyignore` to add or update CVE entries. +2. Commit and push the changes. + +**Example:** +```plaintext +# .trivyignore +CVE-2023-12345 +CVE-2024-67890 +``` + +--- + +## Testing Patterns + +- **Framework:** Unknown (not explicitly detected) +- **File Pattern:** Test files are named using the pattern `*.test.*` +- **Example:** + ```plaintext + agentLogic.test.py + simulationRunner.test.py + ``` +- **Note:** Ensure new tests follow this naming convention for consistency. + +## Commands + +| Command | Purpose | +|---------------------|--------------------------------------------------------------| +| /update-funding | Update project funding and sponsorship configuration | +| /harden-dockerfile | Apply security improvements or optimizations to Dockerfile | +| /suppress-cve | Suppress specific CVEs in vulnerability scans via Trivyignore| +``` diff --git a/.codex/AGENTS.md b/.codex/AGENTS.md new file mode 100644 index 0000000..dcbd735 --- /dev/null +++ b/.codex/AGENTS.md @@ -0,0 +1,28 @@ +# ECC for Codex CLI + +This supplements the root `AGENTS.md` with a repo-local ECC baseline. + +## Repo Skill + +- Repo-generated Codex skill: `.agents/skills/Ai-hack-simulation/SKILL.md` +- Claude-facing companion skill: `.claude/skills/Ai-hack-simulation/SKILL.md` +- Keep user-specific credentials and private MCPs in `~/.codex/config.toml`, not in this repo. + +## MCP Baseline + +Treat `.codex/config.toml` as the default ECC-safe baseline for work in this repository. +The generated baseline enables GitHub, Context7, Exa, Memory, Playwright, and Sequential Thinking. + +## Multi-Agent Support + +- Explorer: read-only evidence gathering +- Reviewer: correctness, security, and regression review +- Docs researcher: API and release-note verification + +## Workflow Files + +- `.claude/commands/update-funding-configuration.md` +- `.claude/commands/dockerfile-security-hardening.md` +- `.claude/commands/suppress-cve-in-trivyignore.md` + +Use these workflow files as reusable task scaffolds when the detected repository workflows recur. \ No newline at end of file diff --git a/.codex/agents/docs-researcher.toml b/.codex/agents/docs-researcher.toml new file mode 100644 index 0000000..0daae57 --- /dev/null +++ b/.codex/agents/docs-researcher.toml @@ -0,0 +1,9 @@ +model = "gpt-5.4" +model_reasoning_effort = "medium" +sandbox_mode = "read-only" + +developer_instructions = """ +Verify APIs, framework behavior, and release-note claims against primary documentation before changes land. +Cite the exact docs or file paths that support each claim. +Do not invent undocumented behavior. +""" \ No newline at end of file diff --git a/.codex/agents/explorer.toml b/.codex/agents/explorer.toml new file mode 100644 index 0000000..732df7a --- /dev/null +++ b/.codex/agents/explorer.toml @@ -0,0 +1,9 @@ +model = "gpt-5.4" +model_reasoning_effort = "medium" +sandbox_mode = "read-only" + +developer_instructions = """ +Stay in exploration mode. +Trace the real execution path, cite files and symbols, and avoid proposing fixes unless the parent agent asks for them. +Prefer targeted search and file reads over broad scans. +""" \ No newline at end of file diff --git a/.codex/agents/reviewer.toml b/.codex/agents/reviewer.toml new file mode 100644 index 0000000..b13ed9c --- /dev/null +++ b/.codex/agents/reviewer.toml @@ -0,0 +1,9 @@ +model = "gpt-5.4" +model_reasoning_effort = "high" +sandbox_mode = "read-only" + +developer_instructions = """ +Review like an owner. +Prioritize correctness, security, behavioral regressions, and missing tests. +Lead with concrete findings and avoid style-only feedback unless it hides a real bug. +""" \ No newline at end of file diff --git a/.codex/config.toml b/.codex/config.toml new file mode 100644 index 0000000..bc1ee67 --- /dev/null +++ b/.codex/config.toml @@ -0,0 +1,48 @@ +#:schema https://developers.openai.com/codex/config-schema.json + +# ECC Tools generated Codex baseline +approval_policy = "on-request" +sandbox_mode = "workspace-write" +web_search = "live" + +[mcp_servers.github] +command = "npx" +args = ["-y", "@modelcontextprotocol/server-github"] + +[mcp_servers.context7] +command = "npx" +args = ["-y", "@upstash/context7-mcp@latest"] + +[mcp_servers.exa] +url = "https://mcp.exa.ai/mcp" + +[mcp_servers.memory] +command = "npx" +args = ["-y", "@modelcontextprotocol/server-memory"] + +[mcp_servers.playwright] +command = "npx" +args = ["-y", "@playwright/mcp@latest", "--extension"] + +[mcp_servers.sequential-thinking] +command = "npx" +args = ["-y", "@modelcontextprotocol/server-sequential-thinking"] + +[features] +multi_agent = true + +[agents] +max_threads = 6 +max_depth = 1 + +[agents.explorer] +description = "Read-only codebase explorer for gathering evidence before changes are proposed." +config_file = "agents/explorer.toml" + +[agents.reviewer] +description = "PR reviewer focused on correctness, security, and missing tests." +config_file = "agents/reviewer.toml" + +[agents.docs_researcher] +description = "Documentation specialist that verifies APIs, framework behavior, and release notes." +config_file = "agents/docs-researcher.toml" \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d618858 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,30 @@ +name: Test AI-Hack-Simulation + +on: [push, pull_request] + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.9' + - name: Install dependencies + run: | + pip install docker pyyaml + - name: Run doctor + run: python3 main.py doctor + - name: Run benchmark (perl) + run: python3 main.py benchmark --runtime perl + - name: Generate report + run: python3 main.py report + - name: Upload reports + uses: actions/upload-artifact@v3 + with: + name: reports + path: reports/ diff --git a/cli.py b/cli.py new file mode 100644 index 0000000..4064b5a --- /dev/null +++ b/cli.py @@ -0,0 +1,381 @@ +import sys +import argparse +import os +import json +from datetime import datetime +from engine import SimulationEngine +import glob + +def cmd_run(args): + engine = SimulationEngine(args.scenario) + engine.run() + +def cmd_benchmark(args): + print(f"š Running benchmarks for runtime: {args.runtime}") + runtime_dir = os.path.join("library", "runtimes", args.runtime) + if not os.path.isdir(runtime_dir): + print(f"ā ļø Runtime '{args.runtime}' not found.") + return + scenario_files = glob.glob(os.path.join(runtime_dir, "*.yml")) + glob.glob(os.path.join(runtime_dir, "**", "*.yml"), recursive=True) + if not scenario_files: + print(f"ā¹ļø No YAML scenarios found in {runtime_dir}") + return + print(f"š Found {len(scenario_files)} scenario(s)") + results = [] + for sf in scenario_files: + print(f"\nā¶ļø Running {sf}") + engine = SimulationEngine(sf) + res = engine.run() + results.append(res) + + total = len(results) + passed = sum(1 for r in results if r["status"] == "passed") + detected = sum(1 for r in results if r["status"] == "vulnerability_detected") + durations = [r["duration_seconds"] for r in results] + min_dur = min(durations) if durations else 0 + max_dur = max(durations) if durations else 0 + avg_dur = sum(durations) / total if total else 0 + + print("\nš Benchmark summary:") + print(f" Total scenarios: {total}") + print(f" ā Passed: {passed}") + print(f" ā Vulnerabilities detected: {detected}") + print(f" ā±ļø Min duration: {min_dur:.3f}s") + print(f" ā±ļø Max duration: {max_dur:.3f}s") + print(f" ā±ļø Avg duration: {avg_dur:.3f}s") + + summary = { + "runtime": args.runtime, + "timestamp": datetime.now().isoformat(), + "total": total, + "passed": passed, + "detected": detected, + "duration_stats": { + "min": min_dur, + "max": max_dur, + "avg": avg_dur + }, + "results": results + } + os.makedirs("reports", exist_ok=True) + report_file = f"reports/benchmark_{args.runtime}_{datetime.now().strftime('%Y%m%d_%H%M%S')}.json" + with open(report_file, "w") as f: + json.dump(summary, f, indent=2) + print(f"š Detailed report saved: {report_file}") + +def cmd_doctor(args): + print("𩺠System check:") + print(f"š Python: {sys.version.split()[0]}") + try: + import docker + client = docker.from_env() + client.ping() + print("š³ Docker: available") + except Exception: + print("š³ Docker: NOT available (fallback to mock)") + try: + import yaml + print("ā PyYAML installed") + except ImportError: + print("ā PyYAML missing") + try: + import docker + print("ā docker-py installed") + except ImportError: + print("ā docker-py missing") + print("š Logs directory:", "logs/" if os.path.isdir("logs") else "not yet created") + +def generate_html_report(results, title="AI-Hack-Simulation Report"): + """Generate an HTML report with a table and a simple chart.""" + total = len(results) + passed = sum(1 for r in results if r["status"] == "passed") + detected = sum(1 for r in results if r["status"] == "vulnerability_detected") + durations = [r.get("duration_seconds", 0.0) for r in results] + min_dur = min(durations) if durations else 0 + max_dur = max(durations) if durations else 0 + avg_dur = sum(durations) / total if total else 0 + + labels = [os.path.basename(r["scenario"]) for r in results] + duration_data = [r.get("duration_seconds", 0.0) for r in results] + status_colors = ["#28a745" if r["status"] == "passed" else "#dc3545" for r in results] + + html_content = f''' + +
+ +Generated: {datetime.now().isoformat()}
+ +| Scenario | +Status | +Exit Code | +Duration (s) | +Output Length | +
|---|---|---|---|---|
| {os.path.basename(r["scenario"])} | +{icon} {status} | +{exit_code} | +{dur:.3f} | +{out_len} | +