Zing Forum

Reading

JungAgent: A Cognitive Architecture with Long-Term Memory and Internal Cycles

JungAgent is a persistent cognitive architecture based on large language models, exploring how AI can metabolize experiences and form a continuous self like living organisms, rather than being just a stateful question-answering tool.

AI架构认知系统长期记忆LLM荣格心理学持久身份开源项目
Published 2026-04-15 09:15Recent activity 2026-04-15 09:18Estimated read 6 min
JungAgent: A Cognitive Architecture with Long-Term Memory and Internal Cycles
1

Section 01

JungAgent: Introduction to a Persistent Cognitive Architecture with Long-Term Memory and Internal Cycles

JungAgent is an open-source project by Brazilian developer Lucas Pedro, aiming to build a persistent cognitive architecture based on large language models. It challenges the traditional stateless LLM's "prompt-response" mode, exploring how AI can metabolize experiences and form a continuous self like living organisms. The core question is: What happens when AI is designed to metabolize experiences over time? The architecture integrates Jungian psychology and Bakhtin's dialogism theory, including modules such as long-term memory, contemplation, dreams, and identity layers.

2

Section 02

Background: Limitations of Stateless LLMs and the Proposal of JungAgent

Most LLM products adopt a stateless design, where the state resets after the conversation ends, remaining only at the tool level and unable to remember past interactions or reflect on experiences. JungAgent attempts to break this paradigm by building a cognitive organism with capabilities such as long-term memory, daily internal cycles, contemplation, and dreams, turning interaction traces into part of the system's internal state.

3

Section 03

Design Inspiration and Memory System

JungAgent's architecture is influenced by Jung (psychological structure and individuation theory support identity layers and dream generation) and Bakhtin (dialogism and polyphony theory guide dialogue continuity). The memory system stores user facts, patterns, milestones, and other information; it is structured and actively integrated (different from passive RAG), providing a foundation for interaction continuity.

4

Section 04

Core Subsystems: Contemplation, Dreams, and Identity

  • Contemplation Module: Processes interaction fragments into tensions, then converts them into insights and connects to the identity layer;
  • Dream Generation: Generates symbolic narratives based on recent memories, processing experiences non-linearly;
  • Identity Layer: Formed dynamically (not hard-coded), including dimensions such as core identity, contradictions, possible selves, and relational identity, evolving with interactions and internal processing.
5

Section 05

World Awareness and Will Modules

  • World Awareness: Enables the system to understand the current historical moment, perceive external tensions and long-term trends, and generate behavioral motivations;
  • Will Module: Drives the system's needs for Knowing, Relating, and Expressing, dynamically balanced by memory, identity, etc., providing internal direction.
6

Section 06

Technical Implementation and Deployment

The project is built with Python, and the tech stack includes FastAPI (management interface), python-telegram-bot (interaction), SQLite (database). The main LLM used is Anthropic Claude, and embeddings are from OpenAI. Currently, it provides Telegram interaction, FastAPI management backend, public landing page, and supports integration with multiple LLM providers.

7

Section 07

Ethical Boundaries and Conclusion

JungAgent focuses on reflective health rather than clinical diagnosis, with commitments including: reflective support rather than authority, crisis referral rather than replacing human care, data protection compliant with LGPD, etc. It represents a direction of architectural innovation—exploring the continuity and internal depth of AI, and proposing the thinking value of "artificial psychology". Project official website: jungagent.org, GitHub: lucasartel/JungAgent