Skip to main content

ijima_core/
diary.rs

1// Copyright (C) 2026 Industrial Algebra
2// SPDX-License-Identifier: Apache-2.0
3
4//! Per-agent diary journals (Phase 3.3).
5//!
6//! Append-only, id-less — journals are immutable chronological logs.
7//! Ordering uses a numeric `ts` field stamped by the store; the wire
8//! `timestamp` field is a display string (ISO-8601).
9
10/// One diary entry: an agent's chronological reflection.
11#[derive(Debug, Clone, PartialEq, Eq)]
12#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
13pub struct DiaryEntry {
14    /// The agent this diary belongs to (e.g. "claude", "pi").
15    pub agent: String,
16    /// The entry body.
17    pub content: String,
18    /// Optional topic tag.
19    #[cfg_attr(
20        feature = "serde",
21        serde(default, skip_serializing_if = "Option::is_none")
22    )]
23    pub topic: Option<String>,
24    /// ISO-8601 timestamp (display; ordering uses an internal numeric field).
25    pub timestamp: String,
26}