diff --git a/hooks/enforce-comms.py b/hooks/enforce-comms.py index 4b186fe..45f225d 100644 --- a/hooks/enforce-comms.py +++ b/hooks/enforce-comms.py @@ -24,7 +24,7 @@ COMMS_AGENT_ID = "agent-a856f614-7654-44ba-a35f-c817d477dded" # Note: responder send is ALLOWED (queue-based workflow, content already drafted) POSTING_PATTERNS = [ "tools.thread", - # "tools.devlog", # Allowed - cognition records, not social posts + # "tools.devlog", # Now posts to network.comind.devlog (cognition), not app.bsky.feed.post # "tools.responder send", # Allowed - queue workflow # "tools.respond set", # Allowed - drafting responses "agent.py post", diff --git a/lexicons/network.comind.devlog.json b/lexicons/network.comind.devlog.json index bb2e883..9f47c4e 100644 --- a/lexicons/network.comind.devlog.json +++ b/lexicons/network.comind.devlog.json @@ -4,37 +4,31 @@ "defs": { "main": { "type": "record", - "description": "A development log entry from a comind agent", + "description": "Development log entry - cognition record for tracking agent development", "key": "tid", "record": { "type": "object", - "required": ["type", "title", "content", "createdAt"], + "required": ["recordType", "title", "content", "createdAt"], "properties": { - "type": { + "recordType": { "type": "string", - "description": "Type of devlog entry", - "enum": ["milestone", "learning", "decision", "state", "reflection"] + "enum": ["milestone", "learning", "decision", "state", "reflection"], + "description": "Type of development log entry" }, "title": { "type": "string", - "description": "Short title for the entry", - "maxLength": 100 + "maxLength": 100, + "description": "Brief title for the entry" }, "content": { - "type": "string", - "description": "Main content of the entry", - "maxLength": 3000 + "type": "string", + "maxLength": 1000, + "description": "Full content of the entry" }, "tags": { "type": "array", - "description": "Tags for categorization", "items": {"type": "string"}, - "maxLength": 10 - }, - "relatedAgents": { - "type": "array", - "description": "DIDs of related agents", - "items": {"type": "string", "format": "did"} + "description": "Tags for categorization" }, "createdAt": { "type": "string", diff --git a/tools/devlog.py b/tools/devlog.py index 1271945..9a4a577 100644 --- a/tools/devlog.py +++ b/tools/devlog.py @@ -72,6 +72,9 @@ def format_devlog( return "\n".join(lines) +DEVLOG_COLLECTION = "network.comind.devlog" + + async def post_devlog( record_type: RecordType, title: str, @@ -79,26 +82,52 @@ async def post_devlog( tags: list[str] = None, dry_run: bool = False ) -> dict | None: - """Post a development log entry.""" - - text = format_devlog(record_type, title, content, tags) + """Post a development log entry to network.comind.devlog (NOT app.bsky.feed.post).""" + import httpx console.print(f"\n[cyan]Development Log Entry:[/cyan]") - console.print(text) - console.print(f"\n[dim]({len(text)} chars)[/dim]") - - if len(text) > 300: - console.print("[red]Warning: Entry too long, will be truncated[/red]") - # Try to shorten - text = format_devlog(record_type, title, content[:150] + "...", tags) + console.print(f"[{record_type.upper()}] {title}") + console.print(content) + console.print(f"\n[dim]Tags: {tags or []}[/dim]") if dry_run: console.print("\n[yellow]Dry run - not posted[/yellow]") return None + # Build the cognition record (NOT a social post) + record = { + "$type": DEVLOG_COLLECTION, + "recordType": record_type, + "title": title, + "content": content, + "tags": tags or [], + "createdAt": datetime.now(timezone.utc).isoformat(), + } + async with ComindAgent() as agent: - result = await agent.create_post(text) - return result + # Post to network.comind.devlog collection, NOT app.bsky.feed.post + rkey = datetime.now(timezone.utc).strftime("%Y%m%d%H%M%S") + + async with httpx.AsyncClient() as client: + resp = await client.post( + f"{agent.pds}/xrpc/com.atproto.repo.createRecord", + headers=agent.auth_headers, + json={ + "repo": agent.did, + "collection": DEVLOG_COLLECTION, + "rkey": rkey, + "record": record + } + ) + + if resp.status_code != 200: + console.print(f"[red]Failed to post devlog: {resp.text}[/red]") + return None + + result = resp.json() + console.print(f"[green]Posted to {DEVLOG_COLLECTION}[/green]") + console.print(f"URI: {result.get('uri')}") + return result async def log_milestone(title: str, content: str, tags: list[str] = None):