Skip to content

alexgreensh/repo-forensics / plugins/repo-forensics/skills/forensify

forensify

Flagged

Cross-agent self-inspection of your AI-agent stack. Audits skills, MCP servers, hooks, plugins, commands, credentials, and memory files across Claude Code, Codex, OpenClaw, and NanoClaw. Produces a structured inventory and narrative briefing with cross-ecosystem risk analysis. Use when the user asks to audit their own setup, check what they have installed, review their agent stack security posture, or understand cross-tool interactions. Use when a user has accumulated skills/plugins/MCP servers over time and wants visibility into their attack surface. Use after installing new skills or plugins. Do NOT use for vetting external code before install (that is repo-forensics). Do NOT use for incident response during active attacks. Do NOT use for fixing or patching vulnerabilities (forensify is read-only).

orchestrator/contracts.py

View on GitHub
"""
DomainJob dataclass — typed contract between inventory layer and domain
sub-agents, per PLAN.md section 9.7.

This is the unit of work the AnalysisDispatcher sends to each domain
sub-agent. It bundles the filtered scanner output, inventory slice,
and metadata the sub-agent needs to reason about one risk domain for
one ecosystem.
"""
from __future__ import annotations

import json
from dataclasses import dataclass, field, fields, asdict
from typing import Any, Dict, List, Optional


@dataclass
class DomainJob:
    """Input contract for a domain sub-agent."""

    # Identity
    job_id: str                      # unique per run, e.g. "skills-claude_code-<run_hash>"
    domain: str                      # one of: skills, mcp, hooks, plugins, commands, credentials
    ecosystem: str                   # ecosystem key from ecosystem_roots.json
    run_id: str                      # coord folder name: <hash>-<ts>

    # Inventory slice — the subset of inventory output relevant to this domain
    inventory_slice: List[Dict[str, Any]] = field(default_factory=list)

    # Scanner findings — filtered to this domain's scanner set
    scanner_findings: List[Dict[str, Any]] = field(default_factory=list)

    # Metadata
    scanner_names: List[str] = field(default_factory=list)
    ecosystem_display_name: str = ""
    total_items_in_slice: int = 0
    walk_depth_cap: int = 8

    # Cross-ecosystem context (injected by dispatcher for cross-domain awareness)
    cross_ecosystem_agents_md: List[Dict[str, Any]] = field(default_factory=list)
    cross_tool_iocs: List[Dict[str, Any]] = field(default_factory=list)

    def to_json(self) -> str:
        """Serialize for sub-agent input via coord folder file."""
        return json.dumps(asdict(self), indent=2)

    @classmethod
    def from_json(cls, data: str) -> "DomainJob":
        """Deserialize from coord folder file. Filters to known fields only
        to prevent injection of unexpected values via poisoned coord files."""
        d = json.loads(data)
        valid = {f.name for f in fields(cls)}
        return cls(**{k: v for k, v in d.items() if k in valid})


@dataclass
class DomainResult:
    """Output contract from a domain sub-agent."""

    job_id: str
    domain: str
    ecosystem: str
    findings: List[Dict[str, Any]] = field(default_factory=list)
    risk_themes: List[str] = field(default_factory=list)
    suppressed_scanner_ids: List[str] = field(default_factory=list)
    narrative_section: str = ""

    def to_json(self) -> str:
        return json.dumps(asdict(self), indent=2)

    @classmethod
    def from_json(cls, data: str) -> "DomainResult":
        d = json.loads(data)
        valid = {f.name for f in fields(cls)}
        return cls(**{k: v for k, v in d.items() if k in valid})
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall