Shift camouflage

From pjt222/agent-almanac · View interactive version

Shift camouflage is an AI agent skill from the GitHub repository pjt222/agent-almanac. Implement cuttlefish-inspired adaptive interfaces — polymorphic APIs, context-aware behavior, feature flags, and attack surface reduction. Covers environmental assessment, chromatophore mapping, dynamic interface generation, behavioral polymorphism, and pattern disruption for systems that must prese

How to use this skill

Skill file

Shift Camouflage

Implement adaptive surface transformation — polymorphic interfaces, context-aware behavior, and dynamic presentation — inspired by cuttlefish chromatophores. The system's surface adapts to its environment while its core remains stable, reducing attack surface and optimizing interaction with diverse observers.

When to Use

Inputs

Procedure

Step 1: Map the Observer Landscape

Identify who interacts with the system and what each observer needs to see.

  1. Catalog all observers:
  1. For each observer, define:
  1. Create the observer-surface matrix:
Observer-Surface Matrix:
┌──────────────┬────────────────────────┬─────────────────┬──────────────┐
│ Observer     │ Required Surface       │ Hidden Surface  │ Threat Level │
├──────────────┼────────────────────────┼─────────────────┼──────────────┤
│ End users    │ Public API v2, UI      │ Internal APIs,  │ Low          │
│              │                        │ admin endpoints │              │
├──────────────┼────────────────────────┼─────────────────┼──────────────┤
│ Partner API  │ Partner API, webhooks  │ Internal logic, │ Medium       │
│              │                        │ user data       │              │
├──────────────┼────────────────────────┼─────────────────┼──────────────┤
│ Admin tools  │ Full API, debug        │ Raw data store  │ Low          │
│              │ endpoints              │ access          │              │
├──────────────┼────────────────────────┼─────────────────┼──────────────┤
│ Adversaries  │ Nothing (minimal)      │ Everything      │ High         │
│              │                        │ possible        │              │
└──────────────┴────────────────────────┴─────────────────┴──────────────┘

Got: A complete observer landscape with surface requirements per observer. This drives all subsequent camouflage design.

If fail: If observer identification is incomplete, start with the two extremes: the most privileged observer (admin) and the most restricted (adversary). Design surfaces for these two, then interpolate for observers between them.

Step 2: Design Chromatophore Mapping

Create the mapping between observer context and surface presentation — the "chromatophore" layer.

  1. Define context signals:
  1. Design the surface generation rules:
  1. Implement the chromatophore layer:
Chromatophore Architecture:
┌──────────────────────────────────────────────────────┐
│ Observer Request                                      │
│        │                                              │
│        ↓                                              │
│ ┌─────────────────┐                                   │
│ │ Context Extract  │ ← Auth, origin, flags, time      │
│ └────────┬────────┘                                   │
│          ↓                                            │
│ ┌─────────────────┐                                   │
│ │ Surface Select   │ ← Observer-surface matrix lookup  │
│ └────────┬────────┘                                   │
│          ↓                                            │
│ ┌─────────────────┐                                   │
│ │ Core System      │ ← Processes request normally      │
│ └────────┬────────┘                                   │
│          ↓                                            │
│ ┌─────────────────┐                                   │
│ │ Surface Filter   │ ← Remove/transform/add elements   │
│ └────────┬────────┘                                   │
│          ↓                                            │
│ Observer Response (adapted surface)                    │
└──────────────────────────────────────────────────────┘

Got: A chromatophore mapping that translates observer context into surface configuration. The mapping is explicit, auditable, and separate from core logic.

If fail: If the mapping becomes too complex (too many context combinations), simplify to role-based surfaces: define 3-5 surface profiles (public, partner, admin, internal, minimal) and map every observer to one profile.

Step 3: Implement Behavioral Polymorphism

Make the system's behavior adapt to context, not just its surface appearance.

  1. Identify context-dependent behaviors:
  1. Implement behavioral variants:
  1. Feature flag integration:

Got: The system's behavior adapts to observer context — the same core logic produces appropriate responses for different audiences. Feature flags enable progressive rollout of new behaviors.

If fail: If behavioral polymorphism creates too many code paths, consolidate to a pipeline model: core logic → policy layer → presentation layer. Polymorphism lives in the policy and presentation layers only, keeping core logic singular.

Step 4: Reduce Attack Surface

Minimize what adversaries can observe and interact with.

  1. Apply the principle of least surface:
  1. Implement active surface reduction:
  1. Deploy pattern disruption:
  1. Monitor for reconnaissance:

Got: A minimal attack surface where adversaries cannot easily determine the system's technology stack, internal structure, or hidden capabilities. Reconnaissance attempts are detected and tracked.

If fail: If surface reduction breaks legitimate consumers, the observer-surface matrix is incomplete — legitimate needs are being hidden. Review Step 1 and update the matrix. If randomization causes issues, reduce randomization to non-functional aspects only (timing, headers) and keep functional responses deterministic.

Step 5: Maintain Surface Coherence

Ensure that the dynamic surface remains consistent, debuggable, and maintainable.

  1. Surface testing:
  1. Surface documentation:
  1. Debugging support:
  1. Surface evolution:

Got: A maintainable, testable, well-documented surface adaptation system. The dynamic nature doesn't compromise the ability to debug, document, or evolve the interfaces.

If fail: If the chromatophore layer becomes a debugging nightmare, add transparency: every response includes a trace header (visible only to admin/debug profile) indicating which surface profile was applied and which context signals determined it.

Validation

Pitfalls

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.