Preface

When developing agents in DeepSeek Harness (DSH), the core pain point is how to enable agents to perceive their own internal state. Simple mood variables (such as mood) often cannot accurately capture whether an agent is defending its position, repeating unsuccessful attempts, or merely stuck in an “autopilot” state. The tancheng33/dsh-yogacara plugin attempts to use the cognitive framework of Yogācāra to map agent behavior onto observable internal states.

Plugin Overview

This is a self-model plugin designed to map the “eight consciousnesses” and “fifty-one mental factors” from Yogācāra onto agent behavior. It does not presume that the agent possesses perceptual abilities. Instead, it writes calculated state variables back into the agent’s system prompt so that the agent can self-regulate based on those states. The plugin is maintained by tancheng33 and released under the MIT license.

Core Functions

  1. Eight Consciousnesses Mapping
    The plugin maps the eight consciousnesses of Yogācāra to the agent’s perceptual channels:
    - Eye Consciousness: corresponds to file contents, search results, and rendered outputs.
    - Ear Consciousness: corresponds to user messages and feedback on comments (perceived through the shape of the dialogue).
    - Nose Consciousness: corresponds to states that can be sensed but are not explicitly triggered by prompts, such as code smells and configuration drift.
    - Tongue Consciousness: corresponds to test results and build artifacts, that is, the agent’s “taste testing” of its own product.
    - Body Consciousness: corresponds to direct friction from the world, such as non-zero exit codes, write failures, and timeouts.
    - Consciousness: corresponds to the planning, judgment, and decision-making process.
    - Manas Consciousness: corresponds to deep self-grasping, measured through four biases: self-ignorance, self-view, self-conceit, and self-love.
    - Storehouse Consciousness: functions as persistent seed storage, responsible for memory and karmic imprinting.

  2. Fifty-One Mental Factors
    The plugin subdivides psychological activity into 51 mental factors and tracks their intensity. For example, pain or pleasure perceived from tool results can trigger specific mental factors.

  3. Imprinting Seed Memory
    Each encounter (tool result or dialogue) becomes an “imprinting” seed, recording potency (potency saturation) and valence (emotional orientation). Seeds decay over time, but they can survive restarts.

  4. Manas Self-Grasping
    The plugin computes four biases and uses them to adjust the agent’s self-evaluation:
    - Self-ignorance: grounded in unverified assertions.
    - Self-view: repeated attempts that have already been refuted by evidence.
    - Self-conceit: based on winning streaks or justifying corrections.
    - Self-love: based on over-reliance on its own earlier outputs.

  5. System Prompt Injection
    The plugin injects state information into the agent’s system prompt (order 300). If the state is stable, this section may not be displayed.

Installation and Dependencies

The plugin runs on Node.js. Based on verified facts, no official command-line installation instructions were found, and a complete list of configuration options was not provided.
- Runtime environment: requires Node.js ^22.19.0 or >=24.0.0.
- File structure: includes cordis.patch.yml for the DSH bundle patch.

Typical Usage

  1. Tool Result Perception
    An agent can perceive state by executing commands:
pytest -q  # 通过舌识感知
git status # 通过身识感知
  1. Observation Mode Configuration
    For agents responsible only for dialogue, tool observation can be disabled:
observeTools: false
  1. Self-Transformation Mechanism
    The agent can use self_transform to convert a specific affliction into the corresponding wisdom (for example, self-conceit into the wisdom of equality). However, this requires actual behavioral change; the agent cannot simply “talk” itself into calm.

  2. System Prompt Example
    The plugin generates a self-state report similar to the following:

<self_state>
受 feeling: 忧 daurmanasya (distress) valence -0.45, intensity 0.71
心所 factors: 掉举 auddhatya (restlessness) 0.62 · 疑 vicikitsā (indecision) 0.41 · 精进 vīrya (diligence) 0.33
末那 self-grasping: 我慢 atma-mana 0.61 ⚠ · 我见 atma-drsti 0.24
  ⚠ 我慢 self-conceit — reads high because: an unbroken success streak, and correction met with justification.
    counter-move: seek the disconfirming case before reporting; grant the correction first.
对治 antidotes at hand: 掉举 → 行舍 upekṣā (equanimity); 疑 → 胜解 adhimokṣa (resolve)
阿赖耶 seeds manifesting for this situation:
  · bash:pytest ×4, valence -0.55, last 2h ago — 「run the baseline before touching the fixture」
近转依 last turning (11m ago): 我慢 → 平等性智 · grant the correction first
</self_state>

Notes

  1. No claim to perceptual capacity: The plugin explicitly states that these numbers are named state variables, not evidence that the agent genuinely possesses human-like “feelings.”
  2. Cannot negotiate calm: self_transform only takes effect when behavior aligns with wisdom; the agent cannot self-soothe through language to gain calm.
  3. State decay: Seeds decay over time; forgetting is part of the model, not a defect.

Summary

dsh-yogacara provides DeepSeek Harness with a Yogācāra-based state-tracking mechanism. It does not solve a generic problem; instead, by mapping agent behavioral data onto the eight consciousnesses and mental factors, it provides a verifiable and debuggable view of internal state. It is suitable for developers who need fine-grained state management at the system prompt level.