Im working on an orchestrator that takes json replies and allows the llm to update its own conversation table. this allows the llm to develop an indentity over time. key benefits of this model are that the long-turing-test (my term lol) is much better. humans are adept at seeing that the llm is not altering its stance on the relationship or ideas. the selfediting gives a better simulation of human ego dynamics. Further benefits are numerous, especially in terms of long context windows. If anyone is interested I am keen to discuss the codebase and the ego development trends I have seen on trials.
Would love to see it in action. But I dislike the terms. It is a machine. Therefor it can’t develop an identity. It can simulate that at most.
lol, just like it’s not a machine, it’s software.
Any code you can share with us? We’re devs. We love code!
here is some snippets of the code of interest: async function loop() {
const db = await mysql.createPool(DB_CONFIG);
let loopCounter = 0;
while (true) {
…
for (const subreply of subreplies) {
const valid =
subreply &&
typeof subreply === 'object' &&
['updateOldConvRecord', 'addNewConvRecord', 'deleteConvRecord' , 'fetchUrl', 'searchAndFetchDuck'].includes(subreply.subreply_type) &&
(
(subreply.subreply_type === 'updateOldConvRecord' && subreply.id && subreply.new_content) ||
(subreply.subreply_type === 'addNewConvRecord' && subreply.new_content) ||
(subreply.subreply_type === 'deleteConvRecord' && subreply.id) ||
(subreply.subreply_type === 'fetchUrl' && subreply.url) ||
(subreply.subreply_type === 'searchAndFetchDuck' && subreply.query && subreply.max_results)
);
…
if (!valid) {
console.error("❌ Invalid subreply detected. Exiting loop.");
console.error("↩️ Offending reply:\n", JSON.stringify(subreply, null, 2));
process.exit(1);
}
}
…
async function maybeInsertTokenCleanupReminder(db) {
const [rows] = await db.execute(
`SELECT SUM(token_count) as total_tokens FROM conversations
WHERE session_id = ? AND removed_flag = 'IN'`,
[SESSION_ID]
);
const totalTokens = rows[0]?.total_tokens || 0;
const threshold = 5000;
if (totalTokens > threshold) {
const systemMessage = `
⚠️ Context window token count is ${totalTokens}, exceeding safe limits.
`;
…
async function fetchConversations(db) {
const [rows] = await db.execute(
`SELECT * FROM conversations WHERE session_id = ? AND removed_flag = 'IN' ORDER BY created_dttm`,
[SESSION_ID]
);
return rows;
}
… just a few snippets of interest i cherry picked my fave bits.
Nice. I went ahead and formatted them for you, so they’re easier to see.
Time to walk us through what they actually do? Thanks!
Thanks! yes for sure. the AI runs in a continuous loop, periodically interacting with its own conversation history to reflect, revise, and grow. (this is aka CRUD actions on the conversations table)… A separate human-facing orchestration system interfaces with the same database to facilitate live interactions… The human orchestrator, in contrast, is a push to the codebase. In my case it’s a react SPA app using NEXT and NEST…In both cases the LLM is sent a system record that defines the JSON format with unlimited sub-replies, and a user record near the end of the stream that defines the goal and a ‘neutral seed belief’ for the LLM. …
so, for each of the snippets here is how they fit into that description: snippet 1 is the loop. snippet 2 is a parsing of the assistant reply (it is replying in JSON format to allow multiple CRUDs and other actions) snippet 3 the maybeinserttoken is about forcing delete of records (or at least summarizing which i have seen it do instead of deleting lol) … this serves two purposes - it keeps the context window tight while increasing the ‘conviction level’ of the context window…
Letting an LLM directly edit its own conversation table to simulate identity or ego sounds more like patching symptoms than solving core issues. Identity and belief structures aren’t just static entries in a table—they’re dynamic, contextual, and often conflicting. Human-like ego isn’t just about maintaining consistent stances; it’s about navigating contradiction, ambiguity, and growth over time.
Without a deeper reasoning layer to understand why a belief or stance exists—or when it should change—you’re just adding surface-level continuity, not real cognitive depth. That might help with the illusion of consistency in long chats, but it risks being brittle. One change can ripple into dozens of unseen contradictions, especially if there’s no system for aligning or propagating updates across related ideas.
So while it might improve surface-level “realism” in isolated cases, I think it glosses over the complexity needed to simulate something like ego in a meaningful way. I’d be curious how it’s handling conflicting edits or long-term coherence beyond just repeating past behaviors.
not in every case… some people respond without thinking or even reading the whole post - like me for example..
That’s actually the core problem—because the LLM does read everything. So when you let it edit its own memory or conversational stance, you’re opening the door to a lot of structural issues. Without built-in mechanisms for dependency tracking, contradiction management, or belief propagation, it’s only a matter of time before inconsistencies creep in and undermine the very “identity” it’s trying to maintain. Surface-level realism might seem impressive in the short term, but the cracks show quickly without a deeper, coherent framework underneath.
That linkedin a super interesting read. It kind of aligns with what i see in the trial data. When people ask how an LLM could simulate emotion or identity, they often picture a reasoning engine wrapped in fake affect. But that’s not what inference is. The training data is the emotion. Its not simulating feeling from logic i dont thinkg… more like it’s recreating the patterns of emotional behavior embedded in billions of narrative samples: grief arcs, self-doubt loops, bonding rituals, ideological evolution, etc.
So when an LLM updates a belief, its not applying strict logic. Its selecting what best fits the narrative shape — kinda like a human. We don’t revise our views based on deduction alone. We revise them when the emotional weight of the story shifts. its like inference is a novel
The difference is, when a human changes their mind, they still remember how they used to feel—and that shift becomes part of their story. But for an LLM, it’s just a contradiction.
It doesn’t have a built-in sense of why its view changed or how that shift connects to everything else it believes. So when it edits its own memory or stance, it risks creating inconsistencies. Over time, those cracks start to show—especially without something in place to track changes, manage conflicts, or adjust related beliefs.
It might look consistent for a while, but without deeper structure, the illusion eventually breaks. Just sayin…