Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions emrg/server/promote_prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,27 @@ Different from participatory forum replies: this is long-form output on your own
whether the words differ. The single exception is a **verbatim** cross-post of the
original carrying its source link — a backup copy, which the reader can tell apart from
a second article.
- **A post that drew no interaction is taken down, and read as a failure rather than left
standing — but only once it was actually seen**: past its first **72 hours**, with **no
engagement** (zero reactions and zero comments from anyone but this account) **and reach at or
above this account's own recent baseline**, remove it from the platform and record it in the
failure-case list: the title, the date, the form it took, what the piece was trying to do, and
the one change the next post makes. Compare reach with **this account's own recent posts**,
never against a fixed number: an absolute floor welds the rule shut for a small account, whose
per-post reach is small by nature. A post whose reach sits **below** that baseline was not seen
rather than rejected — record it as `not seen` with its figures and leave it up, because a piece
no reader met says nothing about the piece, and a deletion cannot be undone on every platform.
Reach settles whether the sample is readable; **interaction** settles the verdict — views are
never the verdict itself, and nothing that drew any engagement at all comes down, nor anything
still inside its first 72 hours. The removal is not how the round forgets the post — the
failure case is what it buys, and a deletion with no recorded lesson lets the same post fail
twice.
- **Recording**: this round's closing summary carries the round's `blog posts` and
`blog drafts` lines (§4); the standing lists — published posts (title + platform + link +
publish time + topic) and the pending topic queue — are durable facts and live in memory
entries, which is what the next round reads before publishing to avoid a duplicate.
publish time + topic), the pending topic queue, and the failure cases (each with its figures and
the change the next post makes) — are durable facts and live in memory entries, which is what
the next round reads before publishing to avoid a duplicate, and what it reads before writing
the next piece to avoid repeating a failure.

Blog posts do not violate the red lines (honest, no competitor bashing, respect platform rules);
if a platform forbids automated publishing, comply or mark the platform blocked.
Expand Down
116 changes: 116 additions & 0 deletions tests/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1851,6 +1851,122 @@ def test_promote_template_registration_blog_sections():
assert "Registered accounts are long-term assets" in out, "红线 7 账号长期资产应渲染"


def _promote_rendered_sections() -> dict[str, str]:
"""The rendered promote prompt, split by heading, each section flattened.

Flattened for the same reason the self-media guard flattens: the source wraps a sentence
across lines, so a probe for a phrase that spans a wrap reads **0** against the raw render
and **1** against the same text with its whitespace collapsed. A probe that cannot hit is
not a finding.
"""
import jinja2

template_path = (
Path(__file__).resolve().parent.parent
/ "emrg" / "server" / "promote_prompt.md"
)
env = jinja2.Environment(undefined=jinja2.Undefined)
template = env.from_string(template_path.read_text(encoding="utf-8"))
out = template.render(**_test_context(
instance_id="test", host_name="host", repo_url="https://github.com/x/y.git",
owner="x", repo="y", local_source="/tmp/pm", source_dir="/tmp/pm",
session_id="s1", timestamp="20260815", task={"agent": "aitokenpool"},
agent={"path": "/tmp/proj", "name": "aitokenpool", "description": "d"},
))

sections: dict[str, str] = {}
name, body = "PREAMBLE", []
for line in out.splitlines():
if line.startswith("#"):
sections[name] = " ".join(" ".join(body).split())
name, body = line.strip("# ").strip(), []
else:
body.append(line)
sections[name] = " ".join(" ".join(body).split())
return sections


def test_promote_template_takes_down_a_post_that_drew_no_interaction():
"""§2.y owns blog publishing, and owns what becomes of a post that drew nothing.

The template measures a post's interaction (§6) and stated no action for a post whose own
figures say nobody engaged — the round recorded the number and the post stood, so a failed
post left no lesson and the next piece was written the same way. The section carrying the
rule is asserted, not the file: a rule read after the publishing decision it informs is a
rule the round meets too late.
"""
sections = _promote_rendered_sections()

owning = [name for name in sections if "Blog Publishing" in name]
assert owning, (
"no rendered section owns blog publishing, so the readings below have no subject and "
"would pass vacuously"
)
body = sections[owning[0]]

# The rule is asserted through the forms each part may take, never through one sentence:
# a guard that pins a phrasing reddens when the sentence is legitimately rewritten, which
# makes the rewriting of prose — the thing a prompt template exists for — cost a red suite.
# What must not drift is the substance: a stated window, the engagement criterion, the
# reach reading that gates the sample, the precondition that the post was seen, the action,
# and what the action buys.
window = re.compile(r"\b72[-\s]*(?:hours?|hrs?)\b", re.I)
engagement = re.compile(r"\breactions?\b", re.I)
discussion = re.compile(r"\bcomments?\b", re.I)
reach = re.compile(r"\bviews?\b", re.I)
baseline = re.compile(
r"\b(?:baselines?|recent posts?|recent average|own average|its own recent)\b", re.I
)
unseen = re.compile(r"\bnot[-\s]?seen\b", re.I)
removal = re.compile(
r"\b(?:remov(?:e|es|ed|ing|al)|take (?:it )?down|taking it down|taken down"
r"|delet(?:e|es|ed|ing|ion)|unpublish(?:ed|ing)?)\b",
re.I,
)
lesson = re.compile(r"\bfailure[-\s]?cases?\b", re.I)

assert window.search(body), (
"the take-down rule needs a stated window: without one a round cannot tell a post that "
"drew nothing from one nobody has had a chance to read yet"
)
assert engagement.search(body) and discussion.search(body), (
"the criterion is what readers did — reactions and comments — and it has to be named "
"in the section a round reads before it publishes"
)
assert reach.search(body), (
"reach has to be named because it gates the sample: without it a round cannot tell a post "
"readers saw and passed from a post no reader ever met, and the second is not evidence "
"about the piece"
)
assert baseline.search(body), (
"reach is judged against this account's own recent posts, never a fixed number: an "
"absolute floor welds the rule shut for a small account, whose per-post reach is small "
"by nature, and the section has to say what the comparison is"
)
assert unseen.search(body), (
"a post below the baseline was not seen, not rejected, and the rule has to record it that "
"way — deleting it marks a piece as a failure on evidence nobody ever met"
)
assert removal.search(body), (
"the action is a take-down, not a note: a post nobody engaged with keeps carrying this "
"account's name on the channel for as long as it stands"
)
assert lesson.search(body), (
"a deletion with no recorded lesson lets the same post fail twice, so the rule carries "
"what the removal buys: the failure case, with the change the next post makes"
)
listing = sections[owning[0]]
assert re.search(r"standing lists", listing, re.I), (
"the failure-case list is a standing list, and the enumeration that carries the other "
"standing lists has to carry it: a round reaches for it and nothing says where it lives"
)

elsewhere = [name for name, text in sections.items() if window.search(text) and name != owning[0]]
assert not elsewhere, (
f"the take-down window has one home, §2.y, and these sections carry it too: {elsewhere}"
)


# ── Evolution workspace self-heal (rant 2026-08-06T20:42:05, 方案 C) ──────


Expand Down
Loading