Skip to content

Add a TCF skill to allow AI TCF against running Simics - #20

Open
clillies wants to merge 2 commits into
intel:mainfrom
clillies:skill
Open

clillies wants to merge 2 commits into
intel:mainfrom
clillies:skill

Conversation

@clillies

@clillies clillies commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@clillies
clillies requested a review from a team as a code owner November 5, 2026 15:37
@clillies
clillies requested review from MagnusIntel and aragners and a balanced review from Copilot November 5, 2026 15:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

4 open issues
What changed in this PR

Adds an “any event” listener API to TcfChannel and introduces a repo-local TCF CLI + skill documentation to help run/inspect TCF against a live agent (e.g., Simics).

Changes:

  • Add onAnyEvent() support in TcfChannel (with ordering after per-event listeners) and unit tests for it.
  • Add a TCF CLI script under .github/skills/tcf/scripts/ to run commands / REPL against a live TCF agent.
  • Wire the CLI into package.json scripts and add a dedicated tsconfig + skill documentation.
File Description
src/​tcf/​channel.ts Adds onAnyEvent() listener set and dispatch logic for all incoming events.
src/​test/​channel.test.ts Adds unit test verifying onAnyEvent ordering and removal behavior.
package.json Extends typecheck and adds npm run tcf CLI entrypoint.
.github/​skills/​tcf/​scripts/​tsconfig.json Adds TS project config for the skill CLI scripts.
.github/​skills/​tcf/​scripts/​tcf-cli.ts Implements a TCF CLI/REPL built on TcfChannel + service wrappers.
.github/​skills/​tcf/​SKILL.md Adds skill documentation for TCF protocol/service reference and the CLI usage.

Review effort: Lite

Comment thread .github/skills/tcf/scripts/tcf-cli.ts Resolved
Comment thread .github/skills/tcf/scripts/tcf-cli.ts Resolved
Comment thread src/tcf/channel.ts Resolved
Comment thread src/test/channel.test.ts Resolved

@aragners aragners left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots and lots of Simics repo stuff. That is not for external github users to know about.

Then I am far from an expert at skills. My AI agent manages this very well without this skill file. Can it be shortened? Seems very long. I assume references to TCF commands etc is good.

Comment thread .github/skills/tcf/SKILL.md Resolved
Comment thread .github/skills/tcf/SKILL.md Resolved
Comment thread .github/skills/tcf/SKILL.md Resolved
Comment thread scripts/tcf-cli.ts Resolved
Comment thread .github/skills/tcf/scripts/tcf-cli.ts Resolved
Comment thread scripts/tcf-cli.ts Resolved
Comment thread package.json Resolved
Comment thread .github/skills/tcf/SKILL.md Resolved

@aragners aragners left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SKILLS file now looks ok to me. Haven't checked the tcf-cli part as Erasmus seems to have reviewed that.

@aragners
aragners dismissed their stale review November 6, 2026 07:53

The Simics internal repo issues are now found. No further comments on SKILLS file from me.

A client that records or shows agent traffic needs all events, also
those of services and events it does not know by name. Simics services
send events that are not in any spec, so listening to a fixed list of
names is not enough.

The trace callback sees every message, but only as text with the fields
joined by spaces. The JSON arguments cannot be parsed back from that
text, for example when a string contains a space.

The new listeners run after the listeners of the event itself, so those
have updated their state first.

The tests with a local TCP server now wait until the server has closed.
server.close() only starts closing, so a test could end with an open
handle, which can make the test runner flaky.

This is a preparation for a TCF skill tool added in the next commit.

Signed-off-by: Claes Lillieskold <claes.lillieskold@intel.com>
Comment thread esbuild.mjs Outdated
const production = process.argv.includes("--production");
const watch = process.argv.includes("--watch");
const tests = process.argv.includes("--tests");
const tcfCli = process.argv.includes("--tcf-cli");

@emanuelen5 emanuelen5 Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a point in keeping this behind an optional flag? Also, then building is not covered by our CI jobs, unless we explicitly add a build command with that flag.

If you remove the option we get less conditions and add coverage in CI. So I think that is better. The diff here should become smaller as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case we also remove the compile:tcf-cli npm-command (scripts entry point).

Comment thread scripts/tcf-cli.ts
*/
import * as fs from "node:fs";
import * as repl from "node:repl";
import { TcfChannel, stringifyJson } from "../src/tcf/channel";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you get absolute imports working? I.e. either

import { TcfChannel, stringifyJson } from "/tcf/channel";

or

import { TcfChannel, stringifyJson } from "@/tcf/channel";

Comment thread esbuild.mjs
logLevel: "warning",
}),
];
await esbuild.context({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something is off with the whitespace. Otherwise it looks better

Coding agents working on the TCF client often guess what a TCF command
takes and returns. The skill points them to the spec page of each
service, and lists the details that are easy to get wrong: replies with
the error report in a later field, 64-bit addresses, and how the Simics
agent reports suspend and resume.

The skill also adds a CLI (npm run tcf) that runs TCF commands on a live
agent with the extension's own TcfChannel and service wrappers. An
agent can then check what Simics really replies before it writes code,
instead of asking the user to start a debug session with traceTcf.

Cost: about 120 tokens in every chat request for the skill description,
and about 1800 more only when a TCF task makes the agent read SKILL.md.

Signed-off-by: Claes Lillieskold <claes.lillieskold@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants