Long-horizon AI agents operating across complex software systems require continuous grounding in institutional state: codebase ASTs, type definitions, API interfaces, memory shards, and constitutional doctrine. Conventionally, agent architectures inject this context via discrete token prefill—serializing documentation into the prompt on every conversation turn.
This discrete prefill paradigm exhibits three structural limits:
To address these limits, we propose Topological Manifold Steering (TMS). Rather than serializing textual documentation into prompt tokens, TMS compiles discrete graphs into continuous, low-rank subspace tensors that modulate the model's latent activations during forward passes.
Let $G = (V, E, W)$ be a weighted graph representing AST symbols, call hierarchies, or constitutional invariant nodes. The affinity matrix $W \in \mathbb{R}^{|V| \times |V|}$ balances structural graph edges against semantic cosine similarity:
$$W_{ij} = \beta \cdot \mathbb{I}[(v_i, v_j) \in E] + (1 - \beta) \cdot \exp\left(-\frac{\|\mathbf{e}_i - \mathbf{e}_j\|_2^2}{2\sigma^2}\right)$$Defining Degree Matrix $D_{ii} = \sum_j W_{ij}$, the Symmetric Normalized Graph Laplacian is:
$$L_{\text{sym}} = I - D^{-1/2} W D^{-1/2}$$Solving the generalized eigenvalue problem $L_{\text{sym}} \mathbf{u}_k = \lambda_k \mathbf{u}_k$ yields the harmonic standing waves of the domain manifold. The first non-trivial eigenvector $\mathbf{u}_1$ (the Fiedler Vector) captures the fundamental macro-axis, while $\mathbf{u}_2, \dots, \mathbf{u}_R$ capture orthogonal structural and invariant constraints.
Rather than projecting a 1D vector (Rank-1), TMS constructs a Rank-$R$ Subspace Tensor $\mathcal{T}_{\text{block}} \in \mathbb{R}^{R \times K}$ containing the top $R$ normalized harmonic eigenvectors:
$$\mathcal{T}_{\text{block}} = \begin{bmatrix} \mathbf{u}_1^T \\ \mathbf{u}_2^T \\ \vdots \\ \mathbf{u}_R^T \end{bmatrix}, \quad \mathbf{\lambda} = [\lambda_1, \lambda_2, \dots, \lambda_R]$$For $R=5$ with 32 FP16 coordinates per mode, the entire manifold payload is stored in **320 bytes**.
Frontier models feature diverse hidden state dimensions ($d_{\text{model}}=5120$ in Gemma 4 31B, $3584$ in Qwen 2.5, $4096$ in Llama 3). To preserve permanent, timeless cartridge storage, cartridges encode intrinsic $K$-dimensional manifold coordinates. At inference time, a static low-rank projection dictionary $P_{\mathcal{M}} \in \mathbb{R}^{K \times d_{\text{model}}}$ expands the coordinates into model space:
$$\mathbf{M}_r = P_{\mathcal{M}} \cdot \mathbf{q}_r \in \mathbb{R}^{d_{\text{model}}}$$At token step $t$ and target layer $\ell$, the residual hidden state $\mathbf{X}_\ell^{(t)} \in \mathbb{R}^{d_{\text{model}}}$ is modulated via weighted multi-mode tensor addition:
$$\mathbf{X}_\ell^{(t)} \leftarrow \mathbf{X}_\ell^{(t)} + \alpha \sum_{r=1}^R \frac{1}{\sqrt{r}} \mathbf{M}_r$$where $\alpha$ is the steering intensity. This continuous tensor addition biases downstream Query-Key inner products and FFN intermediate activations without adding KV cache tokens.
In models featuring alternating sliding-window local attention (4096 window) and global linear attention (e.g. Gemma 4's 5:1 ratio across 60+ layers), steering is placed at intermediate linear attention layers ($\ell \in [36, 44]$), where local syntactic representations have converged into global semantic trajectories.
| Mechanism | Context Representation | Theoretical Memory Footprint | Prefix Cache Status |
|---|---|---|---|
| Full In-Context Prefill | $N$ Discrete Text Tokens | $2 \cdot L \cdot d_{\text{model}} \cdot N \cdot 2\,\text{Bytes}$ (KV Cache) | Subject to Eviction |
| Retrieval-Augmented RAG | $k$ Chunk Tokens | $2 \cdot L \cdot d_{\text{model}} \cdot k \cdot 2\,\text{Bytes}$ (KV Cache) | Partial Invalidation |
| TMS Rank-5 Bundle (Ours) | Continuous Subspace Tensor | $\mathbf{384\,\text{Bytes}}$ (Fixed Static Buffer) | 100% Retained |
Prefix Cache Preservation: Because mutable domain context is stored in 384-byte spectral bundles rather than modifying prompt tokens, the system prompt remains byte-identical across turns, preserving warm Radix Prefix Cache state.
Topological Manifold Steering establishes a formal mathematical bridge between discrete software topology and continuous neural activation steering. By synthesizing multi-harmonic Rank-5 subspace bundles, TMS eliminates background prefill tokens and provides a compact theoretical framework for persistent memory across Transformer architectures.