<?php
require 'examples/boot.php';
require_once dirname(__DIR__).'/Support.php';
use Cognesy\Tell\Tell;
use Cognesy\Tell\TellRequest;
$project = TellHarnessExample::project();
try {
$tell = Tell::open($project);
$tell->workspace()->initialize();
$review = $tell->conversation('release-review');
$review->send(
TellRequest::prompt('Record the release risks and an owner for each.'),
);
$compacted = $review->compact(
TellRequest::prompt('Summarize the release review for the next turn.'),
'Keep risks, owners, and unresolved decisions.',
);
$cleared = $review->clear();
echo "=== Context Lifecycle ===\n";
echo 'Compaction changed head: '
.($compacted->details['changed'] ? 'yes' : 'no')."\n";
echo 'Clear changed head: '.($cleared->changed() ? 'yes' : 'no')."\n";
echo 'Conversation empty: '.($cleared->isEmpty() ? 'yes' : 'no')."\n";
assert(
$compacted->details['changed'] === true,
'Expected compaction to publish a summary.',
);
assert($cleared->isEmpty(), 'Expected clear to select an empty conversation.');
} finally {
TellHarnessExample::remove($project);
}