Skip to content
C.W.K.
Lesson 04 of 05 · published

Rules the App Remembers

~15 min · prompts, templates, appearance, playbooks

Level 0Sketch
0 XP0/43 lessons0/13 achievements
0/100 XP to next level100 XP to go0% complete

A rule that must be remembered will be forgotten

Before Avatars, the rules for a journal cover or a channel thumbnail lived in playbooks: no lettering on covers, English-only lettering on thumbnails, no clickbait, faces faithful to the reference. A brain making a thumbnail had to open the right note, read it and carry it through a long session. A few dozen tokens of rule competing with thousands of tokens of conversation lose often enough to matter. Avatars moves those rules into the app, where code appends them to the prompt every time, whichever brain is asking.

Two kinds of remembered rule became data.

  • Appearance rules belong to a subject: how this soul or person must look, and what must never appear.
  • Workflow templates belong to a kind of image: what every journal cover, thumbnail or clip must obey.

Appearance rules live in the profile

Each reference profile carries appearance, free prose of up to 2000 characters, and each named look may carry its own. The architecture lists the kinds of detail that belong there, and what must never appear. Any standing rule about how a subject is drawn fits the same field. Take an invented one: always framed from the shoulders up, lit softly from the left, never by a hard light overhead. The reference images carry the face. The rule names the details a model tends to drift on, so nobody has to repeat them in a prompt.

look_rule picks the text: the named look's own rule if it has one, otherwise the subject's. It prefixes the display name so each rule says whom it is about, and the resolver keeps each distinct rule once, in the order the subjects were named.

Templates: house rules per workflow

The content workflows are studio, diary, thumbnail and clip. Each has a template seeded in code, and studio starts empty because a general composition has no house style. The comment above the seeds states the arrangement: Dad edits the rules in the app, and the defaults are the seed, not a second copy of a playbook.

WorkflowWhat the seed insists onRecommended ratio
studioNothing: the prompt stands aloneNone
diaryNo readable text anywhere; the same characters as the references; describe only scene, mood and light16:9
thumbnailLegible at feed size on a phone; English-only lettering, exactly the words given; honest framing, never clickbait16:9
clipOne continuous shot in present tense; identity kept from the references; no on-screen text unless the words are given16:9

An edited template is stored as a template record, one per workflow. Saving is version-checked like every other record, so two editors cannot silently overwrite each other: the second save, carrying a stale version, gets This record changed. Refresh before saving again. A save that misjudges whether a stored edit exists at all gets The template changed. Refresh first. instead, and Reset to default deletes the record and returns the seed. On the Create image page the rules sit in a collapsible panel under the prompt, labelled with the workflow and whether its rules are edited or default. Set workflows (create, regenerate, remix) have no template. Their frame rules stay in code, and an attempt to save a template for one is refused with 404.

Composition: three shapes, one tail

compose_prompt builds the text Ember receives, in one of three shapes.

  1. Remix: a fixed instruction that reference image 1 is the exact original for this emotion, then Requested changes: and the prompt. Only the requested change may move.
  2. Set create or regenerate: exactly one named frame, no contact sheet, grid or captions, then the prompt.
  3. Content workflows: the template, a blank line, then the prompt.

Every shape gets the same tail when there are rules: a blank line, the heading Identity rules (Avatars keeps these for every depicted subject):, and one bullet per rule. A set workflow also adds the collection soul's own rule even when no subject was named, because a set always depicts its soul.

The test that guards this, test_prompts_carry_workflow_rules_and_identity_rules, checks that a thumbnail prompt starts with the seed template, contains the scene and ends with the depicted subject's rule. Then it saves an edited thumbnail template and checks that the next plan made on Pippa's behalf starts with the edit. One edit in the app, and every brain's next thumbnail obeys it.

Shown before anything is spent

Because the app composes the prompt, the app can show it. The review step of Create image has a section called Prompt sent to Ember (first image) with the exact composed text, and the package attached to every task carries it as well, so Dad can read what a model was really told. The usage text a brain receives closes the loop from the other side: Avatars appends these rules, so do not restate them. A brain that restated them anyway would only add a second copy that drifts.

Principle: A rule that matters on every run belongs in the code path of every run. Write it once as data its owner can edit, append it mechanically, and show the result before anything is spent.

Code

cwkAvatars, backend/studio.py: the content workflows and their seeded house rules (verbatim, lines 15-41)·python
CONTENT_WORKFLOWS = ("studio", "diary", "thumbnail", "clip")
RECOMMENDED_RATIOS = {"diary": "16:9", "thumbnail": "16:9", "clip": "16:9"}
# House rules for the content workflows. They ride every prompt, from the web
# studio and from Pippa's ImageGen alike, so no brain has to remember a
# playbook to produce a cover or a thumbnail. Dad edits them in the app; the
# defaults below are the seed, not a second copy of a playbook.
DEFAULT_TEMPLATES = {
    "studio": "",
    "diary": (
        "Journal cover illustration, 16:9 landscape. No readable text, lettering, captions, logos or watermarks anywhere in the image.\n"
        "Depict the same character(s) as the reference images: preserve identity, hair, eyes, skin and build exactly; describe only the scene, mood and light.\n"
        "Cinematic photoreal-illustrative rendering consistent with the reference style."
    ),
    "thumbnail": (
        "YouTube thumbnail, 16:9 landscape, composed to read clearly at feed size on a phone.\n"
        "Lettering: English only, exactly the words the prompt specifies and nothing else; bold, clean, high-contrast typography; keep text clear of faces; no logos, watermarks or extra words.\n"
        "Text hierarchy when several lines are given: small accent tag, bold main title, lighter subtitle.\n"
        "Honest framing of the episode, never clickbait.\n"
        "People: preserve each depicted person's identity exactly from their reference images, rendered in one cohesive lighting and style."
    ),
    "clip": (
        "Short video clip used as material for Dad's channel (an intro, an outro or a stock shot), 16:9 landscape.\n"
        "Describe one continuous shot in plain present-tense sentences: who or what is on screen, what they do, how the camera moves, and the light.\n"
        "People: keep each depicted person's identity, hair, eyes and build exactly as in their reference images; change only what the prompt asks.\n"
        "No on-screen text, captions, subtitles, logos or watermarks unless the prompt gives the exact words."
    ),
}
cwkAvatars, backend/studio.py: three prompt shapes, one identity-rules tail (verbatim, lines 360-371)·python
    @staticmethod
    def compose_prompt(body, frame, matched, template="", rules=()):
        if body.workflow == "remix":
            text = f"Create one avatar image for the '{frame}' frame. Reference image 1 is the exact original for this emotion: preserve the same character identity, facial expression, gaze and pose. Change only the appearance or scene requested below. Other references provide styling or supporting identity only. Do not merge expressions or replace this frame with a neutral pose. Output exactly one image, no sheet or labels.\n\nRequested changes:\n{body.prompt}"
        elif body.set_id:
            reference_rule = "Reference image 1 is the matching emotion original. Preserve its identity and expression unless the requested edit explicitly changes them. " if matched else "Preserve the character identity from the references. "
            text = f"Create exactly one avatar frame named '{frame}'. {reference_rule}No contact sheet, grid, captions or multiple variants in one image.\n\n{body.prompt}"
        else:
            text = f"{template.strip()}\n\n{body.prompt}" if template.strip() else body.prompt
        if rules:
            text += "\n\nIdentity rules (Avatars keeps these for every depicted subject):\n" + "\n".join(f"- {rule}" for rule in rules)
        return text
Illustrative: what Ember receives for a journal cover depicting pippa (the template is the verbatim seed; the scene and the framing rule are invented for this lesson)·text
Journal cover illustration, 16:9 landscape. No readable text, lettering, captions, logos or watermarks anywhere in the image.
Depict the same character(s) as the reference images: preserve identity, hair, eyes, skin and build exactly; describe only the scene, mood and light.
Cinematic photoreal-illustrative rendering consistent with the reference style.

Pippa reads on a window seat while rain runs down the glass, late afternoon light.

Identity rules (Avatars keeps these for every depicted subject):
- Pippa: Framed from the shoulders up, soft light from the left, never a hard overhead light.

External links

Exercise

Find a rule on your team that lives only in documentation or in people's heads but must apply to every run of something: a commit message format, a disclaimer every report needs, a style guide for generated text. Turn it into data: a default seeded in code, an edit path with a version check, a reset that returns the seed, and a composition step that appends it mechanically. Then add a preview that shows the final composed text before the action runs.
Hint
Keep the seed in code and the edit in storage, as Avatars does with DEFAULT_TEMPLATES and template records; a reset is then only a delete of the stored edit. Test that an edit made through the UI changes the very next automated run, not only the UI's own preview.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign in — Please sign in to comment.

No comments yet — be the first.