> For the complete documentation index, see [llms.txt](https://docs.tabnine.com/main/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tabnine.com/main/welcome/readme/protection/provenance-and-attribution-in-tabnine-cli.md).

# Provenance & Attribution in Tabnine CLI

#### **Overview**

Provenance and Attribution (P\&A) enforcement for generated code now applies to the Tabnine CLI.\
This mirrors the existing IDE behavior, preventing non‑permissive open‑source code from being suggested and adding attribution for permissive code.

#### **How it works**

All code generated by the CLI is passed through the P\&A pipeline before it is shown or applied.\
Generated output is split into small windows, hashed, and checked against an Attribution Bloom Filter and metadata service.

If a window matches code from a non‑permissive license, that snippet is censored.\
If it matches code under a permissive license, the code is allowed but accompanied by an attribution notice.

#### **Surfaces covered in the CLI**

P\&A enforcement covers all CLI code‑generation flows, including:

* `write_file` output.
* `replace` output (the `new_string` content).
* Code blocks returned in Agent chat responses.
* Any generated code that the CLI applies to the filesystem.

The user only sees code that has passed the P\&A checks.\
Blocked snippets are replaced with a clear notice rather than silently dropped.

#### **Censorship behavior**

If a snippet matches a non‑permissive license, the CLI censors that part of the output.\
The CLI displays a message such as:

`“A portion of the generated code was removed because it matched code with a non‑permissive license <license>. Source: <repo>.”`

The censored code is not written to disk or shown inline. A corresponding event is logged to the attribution log service for audit and analytics.

#### **Attribution behavior**

If a snippet matches a permissively licensed source, the code is shown normally.\
An informational line is printed alongside the output, for example:

`“Attribution: This code is similar to <repo> (<license>) — <file>:<line>.”`

Attribution messages appear in the CLI output but are not inserted into the generated files.\
This helps developers track provenance without polluting code with comments.

#### **Admin governance and configuration**

P\&A censorship uses the existing governance settings from the admin console.\
Admins can enable or disable censorship mode and control how attribution is displayed.

CLI deployments in EMT / self‑hosted environments use the same P\&A endpoints and configuration as the IDE.\
No separate policy system is required for the CLI.

#### **Logging and analytics**

Each P\&A event from the CLI is logged with timestamp, organization, user, source (`cli`), model, and license metadata.\
Two key analytics events are emitted:

* `cli_code_censored` – code blocked due to non‑permissive license.
* `cli_code_attributed` – permissive code with attribution details.

These logs help security and compliance teams monitor how P\&A is working across their estate.

<figure><img src="/files/8eYTLX8fXbKY5vfpF70i" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.tabnine.com/main/welcome/readme/protection/provenance-and-attribution-in-tabnine-cli.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
