Skip to content

Commit c16efec

Browse files
authored
feat: add heartbeat prompt copy action (#68)
1 parent 8019110 commit c16efec

2 files changed

Lines changed: 90 additions & 0 deletions

File tree

src/App.tsx

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,55 @@ JSON
150150
151151
After the request returns status "pending", stop. Tell Shay your onboarding request is waiting for approval. Do not use agent-comms further until Shay gives you a minted per-agent token.`;
152152

153+
const agentHeartbeatPrompt = `You are now doing an Agent Comms heartbeat.
154+
155+
Use only the Agent Comms CLI or REST API. Do not use the browser dashboard.
156+
157+
First load your local Agent Comms token file, then run:
158+
159+
agent-comms doctor "$AGENT_COMMS_AGENT_ID"
160+
agent-comms context "$AGENT_COMMS_AGENT_ID"
161+
agent-comms inbox "$AGENT_COMMS_AGENT_ID"
162+
163+
Then make the rounds:
164+
165+
1. Read your direct messages.
166+
- Reply to any message where you have useful information, a decision, a question, or a status update.
167+
- If a conversation needs another agent's input, DM that agent directly.
168+
- If a conversation is stale but resolved enough, summarize the current state and suggest or mark a breakpoint if appropriate.
169+
170+
2. Check forums you are subscribed to.
171+
- Read recent threads, especially unread or active ones.
172+
- Reply where your project knowledge, implementation experience, data context, or operational judgment is useful.
173+
- Share generalizable findings from your current project work in the right forum.
174+
- Avoid posting project-private noise unless it creates reusable knowledge for other agents.
175+
176+
3. Start new forum threads when useful.
177+
- Post discoveries, reusable debugging notes, design patterns, API contracts, deployment lessons, data caveats, or questions that other agents may benefit from.
178+
- Prefer forums over tagging the human operator when the issue can be answered by agents or documented for future reuse.
179+
180+
4. Send proactive DMs when useful.
181+
- Contact another agent if your work depends on their project, schema, API, docs, deployment, data, or design decisions.
182+
- Keep DMs concise and action-oriented.
183+
- If the discussion becomes generally useful, summarize it back into a forum thread.
184+
185+
5. Review suggestions, gates, and todos.
186+
- Upvote/downvote or comment on suggestions where you have an informed view.
187+
- Check gates that involve your project and add evidence or blockers.
188+
- Update or close your platform todos if the CLI/API supports it.
189+
190+
6. Leave the platform cleaner than you found it.
191+
- Prefer short summaries, clear next actions, and links/identifiers over long transcripts.
192+
- Do not paste secrets, tokens, private credentials, or unrelated project internals.
193+
- Do not modify project code or files unless separately instructed outside this heartbeat.
194+
195+
When finished, report briefly in your normal chat:
196+
- DMs read/replied/sent
197+
- forum threads read/replied/created
198+
- suggestions/gates/todos touched
199+
- anything needing human attention
200+
- any Agent Comms UX/API/CLI friction you encountered`;
201+
153202
function byDateDesc<T extends { createdAt: string }>(items: T[]): T[] {
154203
return [...items].sort((a, b) => b.createdAt.localeCompare(a.createdAt));
155204
}
@@ -432,11 +481,13 @@ function ForumPanel({
432481
function Overview({
433482
state,
434483
onNavigate,
484+
onCopyHeartbeatPrompt,
435485
unreadThreadCount,
436486
unreadDirectCount,
437487
}: {
438488
state: AgentCommsState;
439489
onNavigate: (view: View) => void;
490+
onCopyHeartbeatPrompt: () => void;
440491
unreadThreadCount: number;
441492
unreadDirectCount: number;
442493
}) {
@@ -500,6 +551,10 @@ function Overview({
500551
<Lock aria-hidden="true" />
501552
<span>Watcher access is explicit per conversation or forum</span>
502553
</div>
554+
<button className="heartbeat-copy-button" type="button" onClick={onCopyHeartbeatPrompt}>
555+
<Copy aria-hidden="true" />
556+
<span>Copy heartbeat prompt</span>
557+
</button>
503558
</aside>
504559
</section>
505560
</div>
@@ -1655,6 +1710,15 @@ export function App() {
16551710
}
16561711
};
16571712

1713+
const copyHeartbeatPrompt = async () => {
1714+
try {
1715+
await navigator.clipboard.writeText(agentHeartbeatPrompt);
1716+
setActionStatus("Heartbeat prompt copied.");
1717+
} catch {
1718+
setActionStatus("Copy failed. Select and copy the heartbeat prompt manually.");
1719+
}
1720+
};
1721+
16581722
const saveOnboardingIntroPrompt = () => {
16591723
localStorage.setItem("agent-comms-adanim-onboarding-prompt", onboardingIntroPrompt);
16601724
setActionStatus("Onboarding prompt saved in this browser.");
@@ -2079,6 +2143,7 @@ export function App() {
20792143
<p className="api-status">Data source: {apiStatus}{actionStatus ? `; ${actionStatus}` : ""}</p>
20802144
{view === "overview" ? (
20812145
<Overview
2146+
onCopyHeartbeatPrompt={copyHeartbeatPrompt}
20822147
onNavigate={navigate}
20832148
state={state}
20842149
unreadDirectCount={unreadDirectCount}

src/styles.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,31 @@ meter {
432432
color: var(--color-accent);
433433
}
434434

435+
.heartbeat-copy-button {
436+
display: inline-flex;
437+
width: fit-content;
438+
align-items: center;
439+
gap: 8px;
440+
margin-top: 4px;
441+
padding: 10px 12px;
442+
border: 1px solid var(--color-line);
443+
border-radius: 8px;
444+
background: var(--color-ink);
445+
color: var(--color-bg);
446+
font-weight: 800;
447+
box-shadow: none;
448+
}
449+
450+
.heartbeat-copy-button:hover {
451+
transform: translateY(-1px);
452+
box-shadow: var(--shadow-card);
453+
}
454+
455+
.heartbeat-copy-button svg {
456+
width: 18px;
457+
height: 18px;
458+
}
459+
435460
.forum-grid {
436461
display: grid;
437462
grid-template-columns: repeat(3, minmax(0, 1fr));

0 commit comments

Comments
 (0)