Skip to content

[EPIC] Semantic Handshake: Closing the Context Drift Gap #483

Description

@LorenzaVolponi

🎯 The "Context Drift" Problem
Pedro validated that SYNAPSE handles context injection, and Claude handles compression. However, there is a gap between Intent Definition (Planning) and Intent Execution (Development).

When a story moves from @architect to @dev, constraints can be "compressed away" or ignored. The @dev might choose a library that contradicts the Architecture Doc simply because it was the path of least resistance.

🛠 Solution: The Semantic Handshake Protocol
A middleware layer that treats Architectural Decisions as Code, not just comments.

How it works:

Constraint Extraction: During Planning, the engine scans docs for "Hard Constraints" (Tech Stack, Security Patterns).
Intent Lock: These constraints are converted into executable validators (Assertions).
Pre-Execution Gate: Before @dev writes code, the engine runs a "Semantic Diff". If the code violates a constraint, the execution is blocked and a correction prompt is injected.

📈 Impact on AIOS
Zero Context Drift: Guarantees that "Serverless Architecture" in the PRD results in Serverless Code.
Automated Governance: The @architect gains "supervisory power" over the @dev without human intervention.
Trust: Stakeholders know that what was planned is exactly what is built.

Semantic Handshake.js

Activity

  1. nikolasdehor commented on Mar 11, 2026

    @nikolasdehor
    Contributor

    Boa epic @LorenzaVolponi. O context drift é um problema real em sessões longas. Nosso módulo de Decision Memory (#564) e Agent Reflection Engine (#565) já atacam parte desse problema — mantêm contexto cross-session e aprendem com decisões passadas. Junto com o Strategy Optimizer (#567), conseguimos reduzir drift significativamente. Se quiser alinhamos a implementação com essa epic.

  2. nikolasdehor commented on Mar 18, 2026

    @nikolasdehor
    Contributor

    A epic de Semantic Handshake é muito relevante para o context drift. Alguns dos nossos PRs tocam diretamente nesse problema:

    Se houver interesse, podemos criar um módulo específico de Semantic Handshake que integre esses dois componentes.

  3. github-actions commented on May 8, 2026

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had
    recent activity. It will be closed in 7 days if no further activity occurs.

    If this issue is still relevant, please leave a comment to keep it open.

  4. rafaelscosta commented on May 9, 2026

    @rafaelscosta
    Collaborator

    Triaged and implementation started in PR #717. Scope: deterministic SemanticHandshakeEngine + G5 pre-execution gate, built on top of the merged #447 context runtime; prior PRs #564/#565 were closed unmerged and are not present on main.

  5. rafaelscosta commented on May 9, 2026

    @rafaelscosta
    Collaborator

    Implemented and merged via PR #717 into main.\n\nEvidence:\n- Merge commit: 96d7f59\n- Added SemanticHandshakeEngine under SYNAPSE context runtime.\n- Added blocking G5SemanticHandshakeGate under IDS.\n- Added deterministic extraction for PostgreSQL, serverless local-state, absolute imports and no-eval constraints.\n- Added regression hardening from CodeRabbit: scoped gate engine clone, empty normalized id rejection, deterministic validator-error violations.\n- CI green: ESLint, TypeScript, Jest Node 18/20/22/24/25, manifest validation, story validation, semantic lint, compatibility parity, brownfield install, CodeQL, Coverage, CodeRabbit.\n\nClosing #483 as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions