# SkillFoundry v5.7.0 Release Notes

**Release Date:** 2026-05-06
**Codename:** Adversarial Intelligence

---

## Overview

v5.7.0 adds three features centered on adversarial security: a local vector memory layer that semantically indexes every pipeline run, a Specter Security Engine that red-teams your changes before they ship, and a `/red-team-researcher` skill that brings senior offensive/defensive research expertise into any session.

---

## New Features

### Local Vector Memory

File-based semantic memory using cosine similarity, with a multi-provider embedding chain that always has a local fallback.

**EmbeddingService — provider priority:**

| `preferredProvider` | Order |
|---|---|
| `'ollama'` (default) | ollama → transformers → openai |
| `'openai'` | openai → transformers → ollama |

`TransformersEmbeddingProvider` uses `@xenova/transformers` with the `Xenova/all-MiniLM-L6-v2` model (384 dimensions). It runs entirely locally — no API key, no network call — and is always available as the last-resort fallback.

**VectorStore API:**

```typescript
const svc = new EmbeddingService({ preferredProvider: 'ollama' });
const store = new VectorStore(svc, workDir, { persistPath: 'my-index' });
await store.initialize();

await store.add([{ id: 'doc1', text: 'content', metadata: { type: 'decision' } }]);

const results = await store.search('query text', 5);
// results: SearchResult[] sorted by cosine similarity
```

**Pipeline integration:** `harvestRunMemory` now performs best-effort semantic indexing on every pipeline run. `layeredRecall` combines keyword (SQLite FTS) + semantic (vector cosine) results with score fusion.

---

### Specter Security Engine

An adversarial threat modeling agent that runs automatically in every pipeline, between the INSPECT and DEBRIEF phases.

**Pipeline phases (now 9):**

```
IGNITE → PLAN → FORGE → POLISH → TEMPER → INSPECT → SPECTER → DEBRIEF → FINISH
```

**What Specter does:**

1. **Generate vectors** — `generateVectors(diff, prd, context)` calls an agentic red-team loop that produces attack vectors with id, title, severity, CVSS metadata, and an `exploitSimCommand`
2. **Run simulations** — `runSimulation(vector, context)` executes the command against an allowlist; blocked commands: `curl`, `wget`, `nc`, `ncat`, `nmap`, `rm`, `dd`, `mkfs`, `shred`, `python -c`, `perl -e`, `ruby -e`
3. **Produce a report** — `execute()` returns a JSON report with status (PASS/FAIL), summary, and vectors array

**Registration:**

```
AGENT_REGISTRY.specter = {
  name: 'specter',
  toolCategory: 'FULL',
  archetype: 'implementer',
  displayName: 'Specter Security Engine',
}
```

Agent count is now **62**. Circular import (`specter → agent → agent-registry → specter`) is resolved by removing the static import from agent-registry; use `new SpecterEngine()` directly when the full engine is needed.

---

### Red Team Researcher Skill (`/red-team-researcher`)

A senior security researcher persona installed as a Claude Code slash command. The voice is precise and technical — closer to a Frontier Red Team write-up than a SOC analyst checklist.

**Core operating principles:**
- Adversarial reasoning, defender's intent
- Specificity over surface area (name the file, the line, the data flow)
- Exploit reasoning as the diagnostic (source → sink → primitive → impact)
- Severity grounded in reachability — not textbook threat level

**Finding format:**

```
### [SEV: Critical | High | Medium | Low | Info] <Short title>

**Location:** <file:line or component>
**Class:** <vulnerability class>
**Reachability:** <pre-auth internet / authenticated / admin only / latent>

**What's wrong:** <2–4 sentences on the actual flaw>
**Exploit sketch:** <the chain — source → sink → primitive → impact>
**Fix:** <specific: what the patch must actually do>
**References:** <CWE-XXX>
```

**Reference files (loaded on demand by domain):**

| Domain | File |
|---|---|
| Source code audit, SAST triage | `references/code_review.md` |
| Web/API, OWASP Top 10, auth, SSRF | `references/web_api.md` |
| AWS/Azure/GCP, IAM, k8s, Terraform | `references/cloud_infra.md` |
| STRIDE, attack trees, design review | `references/threat_modeling.md` |
| CVSS, writeup structure, exec summaries | `references/reporting.md` |
| Incident triage, IOC, log review | `references/blue_team.md` |

**Hard guardrails:** No weaponized exploits for unauthorized targets. No C2 frameworks, ransomware, or persistence implants. No credential attacks against named real organizations. Authorization assumed in good faith once stated; red flags override.

**Framework integration:**
- `/security` — STRIDE compliance checklists
- `/pentest` — pre-engagement scoping
- `/specter` — pipeline threat analysis
- `/red-team-researcher` — deep attacker-primitive-level analysis

---

## Infrastructure Changes

- `memory-search.ts`: `runKeywordSearch` converted to `async` (was using `await recallIndex()` inside a sync function)
- `layered-recall.ts`: `recallIndex` call sites in `it()` callbacks made `async`
- `memory-harvest.ts`: VectorStore initialized with correct API (`new VectorStore(embeddingService, workDir)` + `await store.initialize()`)
- Circular import in `agent-registry.ts` resolved by removing `import { SpecterEngine }` static import

---

## Test Suite

**2328 / 2330 tests pass.**

The 2 failures are pre-existing environmental: `health-check.test.ts` tests that expect Ollama to be offline fail when an Ollama server is running on the dev machine.

New test files added:
- `sf_cli/src/core/__tests__/embedding.test.ts`
- `sf_cli/src/core/__tests__/vector-store.test.ts`
- `sf_cli/src/core/__tests__/specter.test.ts`

---

## Migration Notes

No breaking changes. `VectorStore` constructor signature changed from previous internal usage — use `new VectorStore(embeddingService, workDir, options?)` and call `await store.initialize()` before any add/search/delete operations.

`EmbeddingService` no longer has a `getInstance()` static method — use `new EmbeddingService(options?)` directly.

`embed()` now returns `EmbeddingResult { vector: number[], provider: string, dimensions: number, cached: boolean }` instead of `number[]`.
