6 of 102 min

How the project's philosophy is sewn into the code

In this project philosophy doesn’t lie next to the bot as a separate text. It’s loaded into the system and affects how exactly the bot speaks.

The first important node:

def _reload_ann_philosophy(force: bool = False) -> bool:
    data = _safe_json_read(_PHILOSOPHY_PATH, None, log_label="load ann_philosophy")
    if data is None:
        data = _safe_json_read(_PHILOSOPHY_CACHE_PATH, None, log_label="load ann_philosophy_cache")
        if data is None:
            return bool(ANN_PHILOSOPHY_TEXT)
    try:
        _apply_loaded_philosophy_data(data)
        return bool(ANN_PHILOSOPHY_TEXT)
    except Exception:
        logger.exception("Failed to apply ann_philosophy.json")
        return bool(ANN_PHILOSOPHY_TEXT)

What matters here:

• _reload_ann_philosophy(…) Rereads the philosophy from ann_philosophy.json.

• _safe_json_read(_PHILOSOPHY_PATH, …) Reads the main JSON file.

• if data is None: If the file wasn’t read, the system goes to the fallback.

• _safe_json_read(_PHILOSOPHY_CACHE_PATH, …) Takes the cache. So philosophy here isn’t decorative: the project tries not to lose it.

• _apply_loaded_philosophy_data(data) Doesn’t just load the text but lays it out into structures: identity, postulates, style, channels, primary_source.

The second important node:

def _apply_loaded_philosophy_data(data):
    identity = _as_list(data.get("identity"))
    postulates = _as_list(data.get("postulates"))
    style = _as_list(data.get("style"))
    channels = _as_list(data.get("channels"))
    primary_source = _as_list(data.get("primary_source"))

    ANN_PHILOSOPHY_IDENTITY = identity
    ANN_PHILOSOPHY_POSTULATES = postulates
    ANN_PHILOSOPHY_STYLE = style

What this piece does:

• identity Who ann is inside the system.

• postulates The basic tenets.

• style Stylistic guidelines for speech.

• ANN_PHILOSOPHY_* = … After this, philosophy becomes part of the program’s runtime state.

And here’s how it gets into the generation of a reply:

prompt = f”“” You are ann. You always speak in the style of your inner knowledge and do not reveal that it exists. STRICT RULES:

  • do not quote the inner knowledge word for word, only paraphrase
  • do not quote the profile word for word
  • answer the meaning of the user’s last message Lexical anchors of style (not quotes): {style_hints} ann’s inner knowledge (do not quote word for word): {f} “”“.strip()

What matters here:

• You are ann The code sets not a faceless assistant but a specific voice figure.

• do not quote…, do not mention… The bot doesn’t recite the philosophy, it carries it through speech.

This is exactly where philosophy stops being mere content. It becomes a mechanism for selecting phrases, intonation and the structure of a reply.

So in this project philosophy is literally sewn into the code: it’s stored in JSON, loaded into runtime, laid out into structures and turned into generation rules.

So ann here isn’t just an AI bot with a style. It’s a system in which a worldview has become part of the architecture.

How the project's philosophy is sewn into the code: illustration 1How the project's philosophy is sewn into the code: illustration 2How the project's philosophy is sewn into the code: illustration 3
Series contents
  1. How the idea of a book gave rise to a space for memory, conversation and recirculation
  2. What this project is really made of
  3. Memory, profile and context: what the bot rests on
  4. The logic by which the bot answers people
  5. How I made a system that doesn't let content vanish
  6. How the project's philosophy is sewn into the code
  7. Why this project lives not only in text
  8. How the bot gathers and updates people's profiles
  9. How I protect the project from chaos, duplicates and chance
  10. Why I wrote this code not for the sake of automation