# BRAINIAC Change Coupling Analyzer

> BRAINIAC Change Coupling Analyzer is a paid API for AI agents from www.brainiac.software, paid per call via x402, $0.04/call, status unknown (last checked 2026-11-14).

Analyzes source code files and change history to detect coupling risks between modules when a proposed change is made

## Facts

- Endpoint: POST https://www.brainiac.software/api/v1/code/change-coupling-analyze?utm_source=zero.xyz
- Price: $0.04/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/brainiac-change-coupling-analyzer-a39a3584
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_sjho2f_4H-YwrzlWw9Rv-

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability brainiac-change-coupling-analyzer-a39a3584 -d '<json body>'
```

Example prompt: Before I merge my PR that modifies src/b.ts and src/utils.ts, can you analyze coupling risks — here are the source files, the import edges between them, and the last 50 change sets from our git history?

## When to prefer this

Use this endpoint when you need to proactively identify which modules are at risk from a proposed code change, especially when you have access to historical git change sets and an import/dependency graph. It is superior to manual code review for large codebases where ripple effects are non-obvious. It is particularly valuable before merges, refactors, or releases touching shared utilities. It requires no account setup — just a pay-per-call USDC payment via x402 on Base.

## Known failure modes

- Missing required 'files' array returns a validation error
- Files exceeding 100,000 character limit per source are rejected
- More than 200 files or 5,000 module edges causes a schema validation error
- Insufficient USDC balance or x402 payment failure blocks the request
- Empty or malformed module_edges may result in zero findings even if coupling exists
- No change_sets provided means historical co-change coupling cannot be detected

## How this service works

Pay-per-call APIs for AI agents: OFAC sanctions screening, compliance checks, token security, and Base chain data via x402. No account. Fixed USDC price. MCP-ready.

## Output

A JSON object containing a summary (finding count, proposed path count), an array of findings each with a code (e.g. reverse_dependency_coupling, historical_cochange_coupling), severity (low/medium/high), the changed path, the coupled path, evidence strings, a remediation suggestion, and optional co-change count. Also includes explanations of how coupling was detected.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "files": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "path",
     "source"
    ],
    "properties": {
     "path": {
      "type": "string",
      "maxLength": 260,
      "minLength": 1
     },
     "source": {
      "type": "string",
      "maxLength": 100000,
      "minLength": 1
     },
     "language": {
      "enum": [
       "javascript",
       "typescript",
       "python",
       "go",
       "other"
      ],
      "type": "string"
     }
    },
    "additionalProperties": false
   },
   "maxItems": 200,
   "minItems": 1
  },
  "change_sets": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "id",
     "paths"
    ],
    "properties": {
     "id": {
      "type": "string",
      "maxLength": 120,
      "minLength": 1
     },
     "paths": {
      "type": "array",
      "items": {
       "type": "string",
       "maxLength": 260,
       "minLength": 1
      },
      "maxItems": 200,
      "minItems": 1
     }
    },
    "additionalProperties": false
   },
   "maxItems": 500
  },
  "module_edges": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "from_path",
     "to_path"
    ],
    "properties": {
     "kind": {
      "enum": [
       "import",
       "call",
       "data",
       "other"
      ],
      "type": "string"
     },
     "to_path": {
      "type": "string",
      "maxLength": 260,
      "minLength": 1
     },
     "from_path": {
      "type": "string",
      "maxLength": 260,
      "minLength": 1
     }
    },
    "additionalProperties": false
   },
   "maxItems": 5000
  },
  "proposed_paths": {
   "type": "array",
   "items": {
    "type": "string",
    "maxLength": 260,
    "minLength": 1
   },
   "maxItems": 200,
   "minItems": 1
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "summary": {
   "findings": 3,
   "proposed_paths": 1
  },
  "findings": [
   {
    "code": "reverse_dependency_coupling",
    "evidence": [
     "src/c.ts depends on changed path src/b.ts."
    ],
    "severity": "medium",
    "remediation": "Check callers in src/c.ts for compatibility with the proposed change.",
    "changed_path": "src/b.ts",
    "coupled_path": "src/c.ts"
   },
   {
    "code": "reverse_dependency_coupling",
    "evidence": [
     "src/a.ts depends on changed path src/b.ts."
    ],
    "severity": "medium",
    "remediation": "Check callers in src/a.ts for compatibility with the proposed change.",
    "changed_path": "src/b.ts",
    "coupled_path": "src/a.ts"
   },
   "…"
  ],
  "explanations": [
   "Coupling comes from supplied module_edges, import strings resolved against supplied file paths, and co-occurrence in ch…",
   "The snippet is not compiled or executed."
  ]
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/brainiac-change-coupling-analyzer-a39a3584/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from www.brainiac.software](https://www.zero.xyz/host/www.brainiac.software/llms.txt)
